From 393f717bf90e1ad1a2d6d4c416b93a2be4d63a4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez-Mondrag=C3=B3n?= Date: Wed, 20 Mar 2024 09:21:24 -0600 Subject: [PATCH] Add more details to assertion errors --- tests/core.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/core.py b/tests/core.py index 8514429..44f721d 100644 --- a/tests/core.py +++ b/tests/core.py @@ -55,8 +55,8 @@ def validate(self) -> None: "_sdc_sequence": sct.NUMBER, } for column in table_schema.columns: - assert column.name in expected_types - isinstance(column.type, expected_types[column.name]) + assert column.name in expected_types, f"Column {column.name} not found in expected types" + assert isinstance(column.type, expected_types[column.name]), f"Column {column.name} not of expected type {expected_types[column.name]}" # noqa: E501 class SnowflakeTargetCamelcaseComplexSchema(TargetCamelcaseComplexSchema): @@ -87,8 +87,8 @@ def validate(self) -> None: "_sdc_sequence": sct.NUMBER, } for column in table_schema.columns: - assert column.name in expected_types - isinstance(column.type, expected_types[column.name]) + assert column.name in expected_types, f"Column {column.name} not found in expected types" + assert isinstance(column.type, expected_types[column.name]), f"Column {column.name} not of expected type {expected_types[column.name]}" # noqa: E501 class SnowflakeTargetDuplicateRecords(TargetDuplicateRecords): @@ -106,7 +106,7 @@ def validate(self) -> None: } assert result.rowcount == 2 for row in result: - assert len(row) == 8 + assert len(row) == 8, f"Row has unexpected length {len(row)}" assert row[0] in expected_value assert expected_value.get(row[0]) == row[1] @@ -122,8 +122,8 @@ def validate(self) -> None: "_sdc_sequence": sct.NUMBER, } for column in table_schema.columns: - assert column.name in expected_types - isinstance(column.type, expected_types[column.name]) + assert column.name in expected_types, f"Column {column.name} not found in expected types" + assert isinstance(column.type, expected_types[column.name]), f"Column {column.name} not of expected type {expected_types[column.name]}" # noqa: E501 class SnowflakeTargetCamelcaseTest(TargetCamelcaseTest): @@ -152,8 +152,8 @@ def validate(self) -> None: "_sdc_sequence": sct.NUMBER, } for column in table_schema.columns: - assert column.name in expected_types - isinstance(column.type, expected_types[column.name]) + assert column.name in expected_types, f"Column {column.name} not found in expected types" + assert isinstance(column.type, expected_types[column.name]), f"Column {column.name} not of expected type {expected_types[column.name]}" # noqa: E501 class SnowflakeTargetEncodedStringData(TargetEncodedStringData): @@ -244,8 +244,8 @@ def validate(self) -> None: "_sdc_sequence": sct.NUMBER, } for column in table_schema.columns: - assert column.name in expected_types - isinstance(column.type, expected_types[column.name]) + assert column.name in expected_types, f"Column {column.name} not found in expected types" + assert isinstance(column.type, expected_types[column.name]), f"Column {column.name} not of expected type {expected_types[column.name]}" # noqa: E501 class SnowflakeTargetSchemaUpdates(TargetSchemaUpdates): @@ -282,8 +282,8 @@ def validate(self) -> None: "_sdc_sequence": sct.NUMBER, } for column in table_schema.columns: - assert column.name in expected_types - isinstance(column.type, expected_types[column.name]) + assert column.name in expected_types, f"Column {column.name} not found in expected types" + assert isinstance(column.type, expected_types[column.name]), f"Column {column.name} not of expected type {expected_types[column.name]}" # noqa: E501 class SnowflakeTargetReservedWords(TargetFileTestTemplate): @@ -458,8 +458,8 @@ def validate(self) -> None: "_sdc_sequence": sct.NUMBER, } for column in table_schema.columns: - assert column.name in expected_types - isinstance(column.type, expected_types[column.name]) + assert column.name in expected_types, f"Column {column.name} not found in expected types" + assert isinstance(column.type, expected_types[column.name]), f"Column {column.name} not of expected type {expected_types[column.name]}" # noqa: E501 class SnowflakeTargetColumnOrderMismatch(TargetFileTestTemplate):