Spaces:
Build error
Build error
# test_app.py | |
from app import sanitize_input, load_model, generate_text, load_json_data | |
def test_sanitize_input(): | |
assert sanitize_input("Hello, World!") == "Hello, World!" | |
assert sanitize_input("Hello@#$") == "Hello" | |
assert sanitize_input(123) == "Input must be a string." | |
def test_load_model(): | |
model, tokenizer = load_model() | |
assert model is not None | |
assert tokenizer is not None | |
def test_load_json_data(): | |
data = load_json_data() | |
assert isinstance(data, list) | |
assert "name" in data[0] | |
def test_generate_text(): | |
model, tokenizer = load_model() | |
result = generate_text(model, tokenizer, "Describe pentesting.") | |
assert isinstance(result, str) | |