jorisvandenbossche commented on code in PR #41413:
URL: https://github.com/apache/arrow/pull/41413#discussion_r1604935051


##########
python/pyarrow/tests/test_extension_type.py:
##########
@@ -267,6 +267,32 @@ def test_ext_type__storage_type():
     assert ty.__class__ is ParamExtType
 
 
+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

Review Comment:
   ```suggestion
       assert ty.byte_width == 16
       ty = ParamExtType(5)
       assert ty.byte_width == 5
   ```
   
   All those tests should check the extension type itself, and not trough 
`.storage_type`, because the goal of the PR is to make those attributes 
available on the extension type itself?



##########
python/pyarrow/tests/test_extension_type.py:
##########
@@ -267,6 +267,32 @@ def test_ext_type__storage_type():
     assert ty.__class__ is ParamExtType
 
 
+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

Review Comment:
   ```suggestion
           _ = ty.byte_width
   
   
   def test_ext_type_bit_width():
       # Test for fixed-size binary types
       ty = UuidType()
       assert ty.bit_width == 128
       ty = ParamExtType(5)
       assert ty.bit_width == 40
   
       # Test for non fixed-size binary types
       ty = LabelType()
       with pytest.raises(ValueError, match="Non-fixed width type"):
           _ = ty.byte_width
   ```



-- 
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]

Reply via email to