def test_duplicate_headers_to_ab_stream_ignores_duplicates(self): sheet_name = "sheet1" header_values = ["h1", "h1", "h3"] # h1 is ignored because it is duplicate expected_stream_header_values = ["h3"] expected_stream = AirbyteStream( name=sheet_name, json_schema={ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", # For simplicity, the type of every cell is a string "properties": { header: { "type": "string" } for header in expected_stream_header_values }, }, supported_sync_modes=["full_refresh"], ) actual_stream = Helpers.headers_to_airbyte_stream( logger, sheet_name, header_values) self.assertEqual(expected_stream, actual_stream)
def test_headers_to_airbyte_stream_blank_values_terminate_row(self): sheet_name = "sheet1" header_values = ["h1", "", "h3"] expected_stream = AirbyteStream( name=sheet_name, json_schema={ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", # For simplicity, the type of every cell is a string "properties": {"h1": {"type": "string"}}, }, ) actual_stream = Helpers.headers_to_airbyte_stream(logger, sheet_name, header_values) self.assertEqual(expected_stream, actual_stream)
def test_duplicate_headers_to_ab_stream_fails(self): sheet_name = "sheet1" header_values = ["h1", "h1", "h3"] with self.assertRaises(BaseException): Helpers.headers_to_airbyte_stream(sheet_name, header_values)