Skip to content

Commit 03b1223

Browse files
committed
updated test to use synthetic data
1 parent 2f01d95 commit 03b1223

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

tests/datasets/test_fips_to_name_improved.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1+
from unittest.mock import patch
2+
13
import pandas as pd
24
import pandera.pandas as pa
35
import pytest
46
from pandera.errors import SchemaError
57

8+
from cfa.scenarios.dataops.datasets.schemas.fips_to_name import (
9+
tf_synth_data as fips_synth_data,
10+
)
611
from cfa.scenarios.dataops.datasets.schemas.fips_to_name_improved import (
712
extract_schema,
813
load_schema,
@@ -38,8 +43,19 @@ def test_fips_to_name_improved_schemas():
3843

3944

4045
def test_fips_to_name_improved_transform():
46+
# Create mock FIPS data that would be returned by get_data
47+
# This should match the structure expected by the SQL template
48+
# and include state abbreviations that might appear in the raw data
49+
mock_fips_data = fips_synth_data
50+
4151
extract_df = raw_synth_data
42-
tf_df = transform(extract_df)
52+
53+
# Mock the get_data function to return our mock FIPS data
54+
with patch(
55+
"cfa.scenarios.dataops.etl.fips_to_name_improved.get_data"
56+
) as mock_get_data:
57+
mock_get_data.return_value = mock_fips_data
58+
tf_df = transform(extract_df)
4359

4460
# Check if the transformed DataFrame matches the expected schema
4561
assert isinstance(load_schema(tf_df), pd.DataFrame)

0 commit comments

Comments
 (0)