Skip to content

Commit

Permalink
test: add unit test to invalid date type convertion
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbarros committed Dec 3, 2024
1 parent 34d1b1f commit 72d282d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/unit/test_describe.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,3 +582,23 @@ def test_describe_list(summarizer, typeset):

with pytest.raises(NotImplementedError):
describe(config, "", [1, 2, 3], summarizer, typeset)


def test_decribe_series_type_schema(config, summarizer):
"Test describe with invalid date types."
typeset = ProfilingTypeSet(config, type_schema={"date": "datetime"})
data = {
'value': [1, 2, 3, 4],
'date': ['0001-01-01', '9999-12-31', '2022-10-03', '2022-10-04']
}
df = pd.DataFrame(data)
result = describe(config, df, summarizer, typeset)

assert result.variables["date"]["type"] == "DateTime"
assert result.variables["date"]["n_missing"] == 2

typeset = ProfilingTypeSet(config)
result = describe(config, df, summarizer, typeset)

assert result.variables["date"]["type"] == "DateTime"
assert result.variables["date"]["n_missing"] == 2

0 comments on commit 72d282d

Please sign in to comment.