Skip to content

Commit 2514fb3

Browse files
committed
Verify data type and values in list array tests
1 parent 72092f6 commit 2514fb3

File tree

1 file changed

+34
-4
lines changed

1 file changed

+34
-4
lines changed

ruby/red-arrow/test/test-array-builder.rb

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,43 @@ def assert_build(builder_class, raw_array)
148148
end
149149

150150
test("list<uint>s") do
151-
array = Arrow::ArrayBuilder.build([[0, 1, 2], [3, 4]])
152-
assert_equal("list<item: uint8>", array.value_data_type.to_s)
151+
values = [
152+
[0, 1, 2],
153+
[3, 4],
154+
]
155+
array = Arrow::Array.new(values)
156+
data_type = Arrow::ListDataType.new(Arrow::UInt8DataType.new)
157+
assert_equal({
158+
data_type: data_type,
159+
values: [
160+
[0, 1, 2],
161+
[3, 4],
162+
],
163+
},
164+
{
165+
data_type: array.value_data_type,
166+
values: array.to_a,
167+
})
153168
end
154169

155170
test("list<int>s") do
156-
array = Arrow::ArrayBuilder.build([[0, -1, 2], [3, 4]])
157-
assert_equal("list<item: int8>", array.value_data_type.to_s)
171+
values = [
172+
[0, -1, 2],
173+
[3, 4],
174+
]
175+
array = Arrow::Array.new(values)
176+
data_type = Arrow::ListDataType.new(Arrow::Int8DataType.new)
177+
assert_equal({
178+
data_type: data_type,
179+
values: [
180+
[0, -1, 2],
181+
[3, 4],
182+
],
183+
},
184+
{
185+
data_type: array.value_data_type,
186+
values: array.to_a,
187+
})
158188
end
159189
end
160190

0 commit comments

Comments
 (0)