Created
September 23, 2021 18:05
-
-
Save andrewdoss-bit/271bfe18d1eda3e86fe6a94d989c6a5a to your computer and use it in GitHub Desktop.
Unit testing fips_cleaner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@pytest.mark.parametrize( | |
"input, expected", | |
[ | |
('01001', '01001'), # 5-character string in, 5-character string out | |
('1001', '01001'), # 4-character string in, 5-character string out | |
(1001, '01001'), # int in, 5-character string out | |
(1001.0, '01001'), # float in, 5-character string out | |
('11001', '11001'), # Similar to before, but with two digit state code | |
(11001, '11001'), # Similar to before, but with two digit state code | |
(11001.0, '11001'), # Similar to before, but with two digit state code | |
] | |
) | |
def test_fips_cleaner(input, expected): | |
input_series = pd.Series([input]) # Setup | |
cleaned_value = fips_cleaner(input_series).iloc[0] # Compute | |
assert cleaned_value == expected # Assert |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment