fix(python): correct Literal type comparison bugs in assertion classes (#15269)

This commit is contained in:
Sergio Gómez Villamor 2025-11-11 13:55:06 +01:00 committed by GitHub
parent c21af0e29a
commit 0553f28e2a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 4 deletions

View File

@ -38,7 +38,7 @@ class FieldValuesFailThreshold(v1_ConfigModel):
return FieldValuesFailThresholdClass( return FieldValuesFailThresholdClass(
type=( type=(
FieldValuesFailThresholdTypeClass.COUNT FieldValuesFailThresholdTypeClass.COUNT
if self.type == Literal["count"] if self.type == "count"
else FieldValuesFailThresholdTypeClass.PERCENTAGE else FieldValuesFailThresholdTypeClass.PERCENTAGE
), ),
value=self.value, value=self.value,
@ -81,7 +81,7 @@ class FieldValuesAssertion(BaseEntityAssertion):
excludeNulls=self.exclude_nulls, excludeNulls=self.exclude_nulls,
transform=( transform=(
FieldTransformClass(type=FieldTransformTypeClass.LENGTH) FieldTransformClass(type=FieldTransformTypeClass.LENGTH)
if self.field_transform == Literal["length"] if self.field_transform == FieldTransform.LENGTH
else None else None
), ),
), ),

View File

@ -58,7 +58,7 @@ class SqlMetricChangeAssertion(BaseEntityAssertion):
statement=self.statement, statement=self.statement,
changeType=( changeType=(
AssertionValueChangeType.ABSOLUTE AssertionValueChangeType.ABSOLUTE
if self.change_type == Literal["absolute"] if self.change_type == "absolute"
else AssertionValueChangeType.PERCENTAGE else AssertionValueChangeType.PERCENTAGE
), ),
operator=self.operator.operator, operator=self.operator.operator,

View File

@ -64,7 +64,7 @@ class RowCountChangeVolumeAssertion(BaseEntityAssertion):
rowCountChange=RowCountChange( rowCountChange=RowCountChange(
type=( type=(
AssertionValueChangeType.ABSOLUTE AssertionValueChangeType.ABSOLUTE
if self.change_type == Literal["absolute"] if self.change_type == "absolute"
else AssertionValueChangeType.PERCENTAGE else AssertionValueChangeType.PERCENTAGE
), ),
operator=self.operator.operator, operator=self.operator.operator,