Skip to content

Commit 0553f28

Browse files
fix(python): correct Literal type comparison bugs in assertion classes (#15269)
1 parent c21af0e commit 0553f28

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

metadata-ingestion/src/datahub/api/entities/assertion/field_assertion.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def to_field_values_failure_threshold(self) -> FieldValuesFailThresholdClass:
3838
return FieldValuesFailThresholdClass(
3939
type=(
4040
FieldValuesFailThresholdTypeClass.COUNT
41-
if self.type == Literal["count"]
41+
if self.type == "count"
4242
else FieldValuesFailThresholdTypeClass.PERCENTAGE
4343
),
4444
value=self.value,
@@ -81,7 +81,7 @@ def get_assertion_info(
8181
excludeNulls=self.exclude_nulls,
8282
transform=(
8383
FieldTransformClass(type=FieldTransformTypeClass.LENGTH)
84-
if self.field_transform == Literal["length"]
84+
if self.field_transform == FieldTransform.LENGTH
8585
else None
8686
),
8787
),

metadata-ingestion/src/datahub/api/entities/assertion/sql_assertion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def get_assertion_info(
5858
statement=self.statement,
5959
changeType=(
6060
AssertionValueChangeType.ABSOLUTE
61-
if self.change_type == Literal["absolute"]
61+
if self.change_type == "absolute"
6262
else AssertionValueChangeType.PERCENTAGE
6363
),
6464
operator=self.operator.operator,

metadata-ingestion/src/datahub/api/entities/assertion/volume_assertion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def get_assertion_info(
6464
rowCountChange=RowCountChange(
6565
type=(
6666
AssertionValueChangeType.ABSOLUTE
67-
if self.change_type == Literal["absolute"]
67+
if self.change_type == "absolute"
6868
else AssertionValueChangeType.PERCENTAGE
6969
),
7070
operator=self.operator.operator,

0 commit comments

Comments
 (0)