Spaces:
Sleeping

Digitalytics / tests /test_utils.py
faseehsandhu's picture
codebase
31b5ed7
Raw History Blame Contribute Delete
732 Bytes
import pytest
from src.utils.validators import validate_file_format, validate_data_dictionary
def test_validate_file_format():
assert validate_file_format("data.xlsx") == True
assert validate_file_format("data.pdf") == True
assert validate_file_format("data.txt") == False
assert validate_file_format("data.csv") == True
def test_validate_data_dictionary():
valid_dict = {
"columns": ["age", "gender", "income"],
"data": [[25, "M", 50000], [30, "F", 60000]]
}
invalid_dict = {
"columns": ["age", "gender"],
"data": [[25, "M"], [30, "F", 60000]]
}
assert validate_data_dictionary(valid_dict) == True
assert validate_data_dictionary(invalid_dict) == False