def test__get_excess_schema_fields_with_matching_schema(self) -> None: """Tests _get_excess_schema_fields() when base_schema is the same as extended_schema.""" base_schema = [ bigquery.SchemaField("field_1", "INT"), bigquery.SchemaField("field_2", "INT"), ] excess_fields = BigQueryClientImpl._get_excess_schema_fields( base_schema, base_schema ) self.assertListEqual(excess_fields, [])
def test__get_excess_schema_fields_no_excess(self) -> None: """Tests _get_excess_schema_fields() when base_schema is a superset of extended_schema.""" base_schema = [ bigquery.SchemaField("field_1", "INT"), bigquery.SchemaField("field_2", "INT"), ] extended_schema = [bigquery.SchemaField("field_2", "INT")] excess_fields = BigQueryClientImpl._get_excess_schema_fields( base_schema, extended_schema ) self.assertListEqual(excess_fields, [])
def test__get_excess_schema_fields_with_extra_base_schema(self) -> None: """Tests _get_excess_schema_fields() when base_schema has fields not in extended_schema.""" base_schema = [ bigquery.SchemaField("field_1", "INT"), bigquery.SchemaField("field_2", "INT"), ] extended_schema = [ bigquery.SchemaField("field_1", "INT"), bigquery.SchemaField("field_3", "INT"), bigquery.SchemaField("field_4", "INT"), ] excess_fields = BigQueryClientImpl._get_excess_schema_fields( base_schema, extended_schema ) self.assertEqual( excess_fields, [ bigquery.SchemaField("field_3", "INT"), bigquery.SchemaField("field_4", "INT"), ], )