rdblue commented on code in PR #4619:
URL: https://github.com/apache/iceberg/pull/4619#discussion_r857184632
##########
python/tests/expressions/test_expressions_base.py:
##########
@@ -217,3 +217,43 @@ def test_accessor_base_class(foo_struct):
assert base.Accessor(position=9).get(foo_struct) == True
assert base.Accessor(position=10).get(foo_struct) == False
assert base.Accessor(position=11).get(foo_struct) == b"\x19\x04\x9e?"
+
+
+def test_bound_reference_str_and_repr():
+ """Test str and repr of BoundReference"""
+ field = NestedField(field_id=1, name="foo", field_type=StringType(),
is_optional=False)
+ position1_accessor = base.Accessor(position=1)
+ bound_ref = base.BoundReference(field=field, accessor=position1_accessor)
+ assert str(bound_ref) == f"BoundReference(field={repr(field)},
accessor={repr(position1_accessor)})"
+ assert repr(bound_ref) == f"BoundReference(field={repr(field)},
accessor={repr(position1_accessor)})"
+
+
+def test_bound_reference_field_property():
+ """Test str and repr of BoundReference"""
+ field = NestedField(field_id=1, name="foo", field_type=StringType(),
is_optional=False)
+ position1_accessor = base.Accessor(position=1)
+ bound_ref = base.BoundReference(field=field, accessor=position1_accessor)
+ assert bound_ref.field == NestedField(field_id=1, name="foo",
field_type=StringType(), is_optional=False)
Review Comment:
I'm not sure I'd expose `field`, but it should be fine for now.
--
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]