Skip to content

Commit

Permalink
Fix one test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
vkoves committed Mar 20, 2024
1 parent 45310ab commit 7283449
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/data/scripts/unit/test_clean_all_years.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def src_building_data() -> pd.DataFrame:
@pytest.fixture
def csv_file() -> csv.reader:
csvfile = open(get_test_file_path(test_input_file))
return csv.reader(csvfile)
return csv.reader(csvfile)

def test_csv_file_has_some_data(csv_file):
first_line = csv_file.__next__()
Expand All @@ -48,7 +48,7 @@ def test_columns_are_renamed(src_building_data) -> pd.DataFrame:
return df

def test_data_has_positive_ghg_data(test_columns_are_renamed):
df = clean.get_all_ghg_data(test_columns_are_renamed)
df = clean.get_buildings_with_ghg_intensity(test_columns_are_renamed)
assert df is not None
assert np.all(df['GHGIntensity'] > 0)

Expand All @@ -64,12 +64,12 @@ def test_has_last_year_of_data(test_columns_are_renamed) -> pd.DataFrame:

@pytest.fixture
def fixed_strings(test_has_last_year_of_data, test_columns_are_renamed):
return clean.fix_str_cols(test_has_last_year_of_data,
return clean.fix_str_cols(test_has_last_year_of_data,
test_columns_are_renamed)

@pytest.fixture
def fixed_strings_all_years(test_columns_are_renamed):
return clean.fix_str_cols(test_columns_are_renamed,
return clean.fix_str_cols(test_columns_are_renamed,
test_columns_are_renamed)

def test_str_values_remain_the_same_as_origin(fixed_strings_all_years, csv_file):
Expand All @@ -88,7 +88,7 @@ def test_str_values_remain_the_same_as_origin(fixed_strings_all_years, csv_file)
def test_lat_lon_become_strings(fixed_strings):
df = fixed_strings[['Latitude','Longitude']]
assert np.all(df.dtypes == 'string')

def test_int_values_remain_the_same_as_origin(test_has_last_year_of_data):
df = clean.fix_int_cols(test_has_last_year_of_data)
assert np.all(df[clean.int_cols].dtypes == 'Int64')
Expand Down

0 comments on commit 7283449

Please sign in to comment.