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(
type=(
FieldValuesFailThresholdTypeClass.COUNT
if self.type == Literal["count"]
if self.type == "count"
else FieldValuesFailThresholdTypeClass.PERCENTAGE
),
value=self.value,
@ -81,7 +81,7 @@ class FieldValuesAssertion(BaseEntityAssertion):
excludeNulls=self.exclude_nulls,
transform=(
FieldTransformClass(type=FieldTransformTypeClass.LENGTH)
if self.field_transform == Literal["length"]
if self.field_transform == FieldTransform.LENGTH
else None
),
),

View File

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

View File

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