Skip to content

Commit

Permalink
Add more details to assertion errors
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Mar 20, 2024
1 parent 337c330 commit 393f717
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions tests/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand All @@ -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]

Expand All @@ -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):
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 393f717

Please sign in to comment.