def test_process_data_row_from_excel_returns_generator(sample_row_from_excel, region_list): # GIVEN: valid input parameters # WHEN: process_data_row function is called # THEN: (processed rows) generator object is returned processed_rows = process_data_row(sample_row_from_excel, region_list) assert inspect.isgenerator(processed_rows)
def test_process_data_row_with_errors(sample_error_row, region_list): # GIVEN: rows with invalid price data # WHEN: process_data_row function is called # THEN: (transformed rows) generator object is returned data_row = sample_error_row["data_row"] expected_data = sample_error_row["expected_data"] processed_rows = process_data_row(data_row, region_list) rowcount = 0 for row in processed_rows: print(row) assert row == expected_data[rowcount] rowcount += 1
def test_process_data_row_from_csv(sample_row_from_csv, region_list): # GIVEN: valid input parameters # WHEN: process_data_row function is called # THEN: (processed rows) generator object is returned data_row = sample_row_from_csv["data_row"] expected_data = sample_row_from_csv["expected_data"] processed_rows = process_data_row(data_row, region_list) rowcount = 0 for row in processed_rows: print(row) assert row == expected_data[rowcount] rowcount += 1