MCPcopy Create free account
hub / github.com/apache/arrow / TestFeatherFileReader

Class TestFeatherFileReader

c_glib/test/test-feather-file-reader.rb:18–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16# under the License.
17
18class TestFeatherFileReader < Test::Unit::TestCase
19 include Helper::Buildable
20
21 def setup_file(table)
22 tempfile = Tempfile.open("arrow-feather-file-reader")
23 output = Arrow::FileOutputStream.new(tempfile.path, false)
24 begin
25 table.write_as_feather(output)
26 ensure
27 output.close
28 end
29
30 input = Arrow::MemoryMappedInputStream.new(tempfile.path)
31 begin
32 reader = Arrow::FeatherFileReader.new(input)
33 yield(reader)
34 ensure
35 input.close
36 end
37 end
38
39 test("#read") do
40 table = build_table("message" => build_string_array(["Login"]),
41 "is_critical" => build_boolean_array([true]))
42 setup_file(table) do |reader|
43 assert do
44 reader.version >= 2
45 end
46 assert_equal(table, reader.read)
47 end
48 end
49
50 test("#read_indices") do
51 table = build_table("message" => build_string_array(["Login"]),
52 "is_critical" => build_boolean_array([true]),
53 "host" => build_string_array(["www"]))
54 setup_file(table) do |reader|
55 assert_equal(build_table("message" => build_string_array(["Login"]),
56 "host" => build_string_array(["www"])),
57 reader.read_indices([2, 0]))
58 end
59 end
60
61 test("#read_names") do
62 table = build_table("message" => build_string_array(["Login"]),
63 "is_critical" => build_boolean_array([true]),
64 "host" => build_string_array(["www"]))
65 setup_file(table) do |reader|
66 assert_equal(build_table("message" => build_string_array(["Login"]),
67 "host" => build_string_array(["www"])),
68 reader.read_names(["message", "host"]))
69 end
70 end
71end

Callers

nothing calls this directly

Calls 3

testFunction · 0.85
versionMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected