File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ from unittest .mock import patch
2+
13import pandas as pd
24import pandera .pandas as pa
35import pytest
46from 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+ )
611from 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
4045def 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 )
You can’t perform that action at this time.
0 commit comments