Skip to content

Commit

Permalink
add non fixed-size binary type test
Browse files Browse the repository at this point in the history
  • Loading branch information
llama90 committed May 17, 2024
1 parent baa05a4 commit ac579ea
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions python/pyarrow/tests/test_extension_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,18 +268,30 @@ def test_ext_type_storage_type():


def test_ext_type_byte_width():
# Test for fixed-size binary types
ty = UuidType()
assert ty.storage_type.byte_width == 16
ty = ParamExtType(5)
assert ty.storage_type.byte_width == 5

# Test for non fixed-size binary types
ty = LabelType()
with pytest.raises(ValueError, match="Non-fixed width type"):
_ = ty.storage_type.byte_width


def test_ext_type_bit_width():
# Test for fixed-size binary types
ty = UuidType()
assert ty.storage_type.bit_width == 128
ty = ParamExtType(5)
assert ty.storage_type.bit_width == 40

# Test for non fixed-size binary types
ty = LabelType()
with pytest.raises(ValueError, match="Non-fixed width type"):
_ = ty.storage_type.byte_width


def test_ext_type_as_py():
ty = UuidType()
Expand Down

0 comments on commit ac579ea

Please sign in to comment.