def test_literal_promotions(table, op, name, case, ex_type): col = table[name] result = op(col, case) ex_class = dt.array_type(ex_type) assert isinstance(result, ex_class) result = op(case, col) ex_class = dt.array_type(ex_type) assert isinstance(result, ex_class)
def _check_literal_promote_cases(self, op, cases): for name, val, ex_type in cases: col = self.table[name] result = op(col, val) ex_class = dt.array_type(ex_type) assert isinstance(result, ex_class) result = op(val, col) ex_class = dt.array_type(ex_type) assert isinstance(result, ex_class)
def test_string_to_number(table, type): casted = table.g.cast(type) assert isinstance(casted, dt.array_type(type)) casted_literal = ibis.literal('5').cast(type).name('bar') assert isinstance(casted_literal, dt.scalar_type(type)) assert casted_literal.get_name() == 'bar'
def test_string_to_number(table, type): casted = table.g.cast(type) assert isinstance(casted, dt.array_type(type)) casted_literal = ibis.literal("5").cast(type).name("bar") assert isinstance(casted_literal, dt.scalar_type(type)) assert casted_literal.get_name() == "bar"
def test_string_to_number(self): types = ['int8', 'int32', 'double', 'float'] for t in types: c = 'g' casted = self.table[c].cast(t) assert isinstance(casted, dt.array_type(t)) casted_literal = ibis.literal('5').cast(t).name('bar') assert isinstance(casted_literal, dt.scalar_type(t)) assert casted_literal.get_name() == 'bar'
def test_getitem_column_select(self): for k, v in self.schema_dict.iteritems(): col = self.table[k] # Make sure it's the right type assert isinstance(col, ArrayExpr) assert isinstance(col, array_type(v)) # Ensure we have a field selection with back-reference to the table parent = col.parent() assert isinstance(parent, ops.TableColumn) assert parent.parent() is self.table
(operator.pow, 'b', 1.5, 'double'), (operator.pow, 'c', 1.5, 'double'), (operator.pow, 'd', 1.5, 'double'), (operator.pow, 'e', 2, 'float'), (operator.pow, 'f', 2, 'double'), (operator.pow, 'a', -2, 'double'), (operator.pow, 'b', -2, 'double'), (operator.pow, 'c', -2, 'double'), (operator.pow, 'd', -2, 'double'), ], ids=lambda arg: str(getattr(arg, '__name__', arg))) def test_literal_promotions(table, op, name, case, ex_type): col = table[name] result = op(col, case) ex_class = dt.array_type(ex_type) assert isinstance(result, ex_class) result = op(case, col) ex_class = dt.array_type(ex_type) assert isinstance(result, ex_class) @pytest.mark.xfail(raises=AssertionError, reason='NYT') def test_add_array_promotions(): assert False @pytest.mark.xfail(raises=AssertionError, reason='NYT') def test_subtract_array_promotions(): assert False