@@ -191,7 +191,7 @@ class Expecteds:
191
191
EXPECTEDS .new
192
192
EXPECTEDS .diffed_exports = EXPECTEDS .raw_exports + \
193
193
[diff_name for diff_name in EXPECTEDS .common_diffs .values () if diff_name is not None ]
194
- EXPECTEDS .filtered_exports = [f [: - 5 ] for f in EXPECTEDS .diffed_exports if f .endswith (".diff" )] + \
194
+ EXPECTEDS .filtered_exports = [f . replace ( ".diff" , "" ) for f in EXPECTEDS .diffed_exports if f .endswith (".diff" )] + \
195
195
EXPECTEDS .new
196
196
197
197
def _assert_frames_equal_ignore_row_order (df1 , df2 , index_cols : List [str ] = None ):
@@ -207,7 +207,7 @@ def set_up(self, tmp_path):
207
207
def check_filtered_exports (self , export_dir ):
208
208
assert set (listdir (export_dir )) == set (EXPECTEDS .filtered_exports )
209
209
for f in EXPECTEDS .filtered_exports :
210
- example = CSVS [f [: - 4 ] ]
210
+ example = CSVS [f . replace ( ".csv" , "" ) ]
211
211
_assert_frames_equal_ignore_row_order (
212
212
pd .read_csv (join (export_dir , f ), dtype = CSV_DTYPES ),
213
213
example .after if example .diff is None else example .diff ,
@@ -247,11 +247,12 @@ def test_diff_and_filter_exports(self, tmp_path):
247
247
248
248
deleted_files , common_diffs , new_files = arch_diff .diff_exports ()
249
249
250
- # Check return values
250
+ # Check deleted, common, diffed, and new file names match expected
251
251
assert set (deleted_files ) == {join (cache_dir , f ) for f in EXPECTEDS .deleted }
252
252
assert set (common_diffs .keys ()) == {
253
253
join (export_dir , csv_name ) for csv_name in EXPECTEDS .common_diffs }
254
254
assert set (new_files ) == {join (export_dir , f ) for f in EXPECTEDS .new }
255
+ # Check that diffed file names are identical
255
256
assert all (
256
257
(common_diffs [join (export_dir , csv_name )] ==
257
258
None if diff_name is None else join (export_dir , diff_name ))
@@ -266,7 +267,7 @@ def test_diff_and_filter_exports(self, tmp_path):
266
267
if diff_name is None : continue
267
268
_assert_frames_equal_ignore_row_order (
268
269
pd .read_csv (join (export_dir , diff_name ), dtype = CSV_DTYPES ),
269
- CSVS [key [: - 4 ] ].diff ,
270
+ CSVS [key . replace ( ".csv" , "" ) ].diff ,
270
271
index_cols = ["geo_id" ]
271
272
)
272
273
0 commit comments