Skip to content

Commit adfc5f4

Browse files
authored
GH-45897: [Ruby] Unify test for table in raw_records and each_raw_record (#45977)
### Rationale for this change The PR reduces duplicated test cases and ensures that both `raw_records` and `each_raw_record` behave consistently by extracting their common test cases. - `Arrow::Table#each_raw_record` - `Arrow::Table#raw_records` ### What changes are included in this PR? We extracted shared test cases about tables used by both `raw_records` and `each_raw_record`. ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * GitHub Issue: #45897 Authored-by: otegami <[email protected]> Signed-off-by: Sutou Kouhei <[email protected]>
1 parent 3828a2e commit adfc5f4

File tree

2 files changed

+19
-50
lines changed

2 files changed

+19
-50
lines changed

ruby/red-arrow/test/each-raw-record/test-table.rb

Lines changed: 0 additions & 47 deletions
This file was deleted.

ruby/red-arrow/test/raw-records/test-table.rb

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
class RawRecordsTableTest < Test::Unit::TestCase
19-
test("2 arrays") do
18+
module RawRecordsTableTests
19+
def test_2_arrays
2020
raw_record_batches = [
2121
[
2222
[true, nil, "Ruby"],
@@ -42,6 +42,22 @@ class RawRecordsTableTest < Test::Unit::TestCase
4242
Arrow::RecordBatch.new(schema, record_batch)
4343
end
4444
table = Arrow::Table.new(schema, record_batches)
45-
assert_equal(raw_records, table.raw_records)
45+
assert_equal(raw_records, actual_records(table))
46+
end
47+
end
48+
49+
class EachRawRecordTableTest < Test::Unit::TestCase
50+
include RawRecordsTableTests
51+
52+
def actual_records(target)
53+
target.each_raw_record.to_a
54+
end
55+
end
56+
57+
class RawRecordsTableTest < Test::Unit::TestCase
58+
include RawRecordsTableTests
59+
60+
def actual_records(target)
61+
target.raw_records
4662
end
4763
end

0 commit comments

Comments
 (0)