kou commented on code in PR #46305:
URL: https://github.com/apache/arrow/pull/46305#discussion_r2075546503


##########
c_glib/test/test-fixed-shape-tensor-data-type.rb:
##########
@@ -0,0 +1,82 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+class TestFixedShapeTensorDataType < Test::Unit::TestCase
+  def test_type
+    data_type = Arrow::FixedShapeTensorDataType.new(Arrow::UInt64DataType.new,
+                                                    [3, 4],
+                                                    [1, 0],
+                                                    ["x", "y"])
+    assert_equal(Arrow::Type::EXTENSION, data_type.id)
+  end
+
+  def test_name
+    data_type = Arrow::FixedShapeTensorDataType.new(Arrow::UInt64DataType.new,
+                                                    [3, 4],
+                                                    [1, 0],
+                                                    ["x", "y"])
+    assert_equal("extension", data_type.name)
+    assert_equal("arrow.fixed_shape_tensor", data_type.extension_name)

Review Comment:
   Could you use one assertion for related values for easy to debug?
   See also: https://www.clear-code.com/blog/2011/2/28.html
   
   ```suggestion
       assert_equal(["extension", "arrow.fixed_shape_tensor"],
                    [data_type.name, data_type.extension_name])
   ```



##########
c_glib/test/test-fixed-shape-tensor-data-type.rb:
##########
@@ -0,0 +1,82 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+class TestFixedShapeTensorDataType < Test::Unit::TestCase
+  def test_type
+    data_type = Arrow::FixedShapeTensorDataType.new(Arrow::UInt64DataType.new,
+                                                    [3, 4],
+                                                    [1, 0],
+                                                    ["x", "y"])
+    assert_equal(Arrow::Type::EXTENSION, data_type.id)
+  end
+
+  def test_name
+    data_type = Arrow::FixedShapeTensorDataType.new(Arrow::UInt64DataType.new,
+                                                    [3, 4],
+                                                    [1, 0],
+                                                    ["x", "y"])
+    assert_equal("extension", data_type.name)
+    assert_equal("arrow.fixed_shape_tensor", data_type.extension_name)
+  end
+
+  def test_to_s
+    data_type = Arrow::FixedShapeTensorDataType.new(Arrow::UInt64DataType.new,
+                                                    [3, 4],
+                                                    [1, 0],
+                                                    ["x", "y"])
+    
assert_true(data_type.to_s.start_with?("extension<arrow.fixed_shape_tensor"))

Review Comment:
   Could you use power-assert for predicate?
   
   ```suggestion
       assert do
         data_type.to_s.start_with?("extension<arrow.fixed_shape_tensor")
       end
   ```



##########
c_glib/test/test-fixed-shape-tensor-data-type.rb:
##########
@@ -0,0 +1,82 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+class TestFixedShapeTensorDataType < Test::Unit::TestCase
+  def test_type
+    data_type = Arrow::FixedShapeTensorDataType.new(Arrow::UInt64DataType.new,
+                                                    [3, 4],
+                                                    [1, 0],
+                                                    ["x", "y"])
+    assert_equal(Arrow::Type::EXTENSION, data_type.id)
+  end
+
+  def test_name
+    data_type = Arrow::FixedShapeTensorDataType.new(Arrow::UInt64DataType.new,
+                                                    [3, 4],
+                                                    [1, 0],
+                                                    ["x", "y"])
+    assert_equal("extension", data_type.name)
+    assert_equal("arrow.fixed_shape_tensor", data_type.extension_name)
+  end
+
+  def test_to_s
+    data_type = Arrow::FixedShapeTensorDataType.new(Arrow::UInt64DataType.new,
+                                                    [3, 4],
+                                                    [1, 0],
+                                                    ["x", "y"])
+    
assert_true(data_type.to_s.start_with?("extension<arrow.fixed_shape_tensor"))
+  end
+
+  def test_empty_shape
+    data_type = Arrow::FixedShapeTensorDataType.new(Arrow::UInt64DataType.new,
+                                                    [],
+                                                    [],
+                                                    [])
+    assert_equal(Arrow::Type::EXTENSION, data_type.id)

Review Comment:
   Can we change this when we add `Arrow::FixedShapeTensorDataType#shape` in 
follow-up PR?



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to