hedger9487 commented on code in PR #3854:
URL: https://github.com/apache/iceberg-python/pull/3854#discussion_r3875349736
##########
tests/test_transforms.py:
##########
@@ -513,6 +513,37 @@ def test_truncate_method(type_var: PrimitiveType, value:
Any, expected_human_str
assert truncate_transform.satisfies_order_of(truncate_transform)
+def test_truncate_satisfies_order_of() -> None:
+ # Width comparison
+ assert TruncateTransform(5).satisfies_order_of(TruncateTransform(3))
+ assert TruncateTransform(5).satisfies_order_of(TruncateTransform(5))
+ assert not TruncateTransform(3).satisfies_order_of(TruncateTransform(5))
+ assert TruncateTransform(10).satisfies_order_of(TruncateTransform(1))
+ assert not TruncateTransform(1).satisfies_order_of(TruncateTransform(10))
+ assert TruncateTransform(1).satisfies_order_of(TruncateTransform(1))
+
+ # Cross-transform comparisons
+ assert not TruncateTransform(5).satisfies_order_of(BucketTransform(5))
+ assert not TruncateTransform(5).satisfies_order_of(IdentityTransform())
+ assert not TruncateTransform(5).satisfies_order_of(VoidTransform())
+ assert not TruncateTransform(5).satisfies_order_of(DayTransform())
+ assert not TruncateTransform(5).satisfies_order_of(YearTransform())
+ assert not
TruncateTransform(5).satisfies_order_of(UnknownTransform("unknown"))
+
+ # Non-transform comparisons
+ assert not TruncateTransform(5).satisfies_order_of(None) # type: ignore
Review Comment:
Thanks for the catch, @rambleraptor!
The mypy error was:
`Argument 1 to "satisfies_order_of" has incompatible type "None" (and "str",
"int"); expected "Transform[Any, Any]"`
These assertions were initially added as overzealous checks for arbitrary
inputs. However, as you noted, the function signature strictly contracts
`other: Transform[S, T]`, and `satisfies_order_of` is specifically intended for
comparing `Transform` instances (consistent with `IdentityTransform` and
others). Testing non-transform types with `# type: ignore` violated the API
contract.
I have removed those three non-transform assertions in commit 6ccb30d to
keep the test suite strictly typed and eliminate the `# type: ignore` comments.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]