]>
git.proxmox.com Git - ceph.git/blob - ceph/src/arrow/ruby/red-arrow/test/test-column.rb
1 # Licensed to the Apache Software Foundation (ASF) under one
2 # or more contributor license agreements. See the NOTICE file
3 # distributed with this work for additional information
4 # regarding copyright ownership. The ASF licenses this file
5 # to you under the Apache License, Version 2.0 (the
6 # "License"); you may not use this file except in compliance
7 # with the License. You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing,
12 # software distributed under the License is distributed on an
13 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 # KIND, either express or implied. See the License for the
15 # specific language governing permissions and limitations
18 class ColumnTest
< Test
::Unit::TestCase
20 table
= Arrow
::Table.new("visible" => [true, nil, false])
21 @column = table
.visible
25 assert_equal("visible", @column.name
)
29 assert_equal(Arrow
::BooleanDataType.new
, @column.data_type
)
45 assert_equal([true, nil, false], @column.each
.to_a
)
48 test("#reverse_each") do
49 assert_equal([false, nil, true], @column.reverse_each
.to_a
)
53 assert_equal(3, @column.n_rows
)
57 assert_equal(1, @column.n_nulls
)
60 sub_test_case("#==") do
62 table1
= Arrow
::Table.new("visible" => [true, false])
63 table2
= Arrow
::Table.new("visible" => [true, false])
65 table1
.visible
== table2
.visible
69 test("different name") do
70 table1
= Arrow
::Table.new("visible" => [true, false])
71 table2
= Arrow
::Table.new("invisible" => [true, false])
73 not table1
.visible
== table2
.invisible
77 test("different value") do
78 table1
= Arrow
::Table.new("visible" => [true, false])
79 table2
= Arrow
::Table.new("visible" => [true, true])
81 not table1
.visible
== table2
.visible
85 test("not Arrow::Column") do
86 table
= Arrow
::Table.new("visible" => [true, false])
88 not table
.visible
== 29