def test_pickle_asof_join(): left = ibis.table([('time', 'int32'), ('value', 'double')]) right = ibis.table([('time', 'int32'), ('value2', 'double')]) joined = api.asof_join(left, right, 'time') node = joined.op() assert_pickle_roundtrip(node)
def test_pickle_projection_node(table): m = table.mutate(foo=table.f * 2) def f(x): return (x.foo * 2).name('bar') node = m.projection([f, 'f']).op() assert_pickle_roundtrip(node)
def test_pickle_multiple_case_node(table): case1 = table.a == 5 case2 = table.b == 128 case3 = table.c == 1000 result1 = table.f result2 = table.b * 2 result3 = table.e default = table.d expr = (ibis.case().when(case1, result1).when(case2, result2).when( case3, result3).else_(default).end()) op = expr.op() assert_pickle_roundtrip(op)
def test_pickle_group_by(table): m = table.mutate(foo=table.f * 2, bar=table.e / 2) expr = m.group_by(lambda x: x.foo).size() node = expr.op() assert_pickle_roundtrip(node)
def test_pickle_table_node(table): n0 = table.op() assert_pickle_roundtrip(n0)
def test_pickling_support(): obj = MagicString(foo="magic", bar=True, baz=8) assert_pickle_roundtrip(obj)
def test_pickle_literal_interval(): a = ibis.interval(seconds=1).op() assert_pickle_roundtrip(a)
def test_pickle_literal(): a = Literal(1, datatypes.int16) b = Literal(1, datatypes.int32) assert_pickle_roundtrip(a) assert_pickle_roundtrip(b)
def test_pickling_support(obj): assert_pickle_roundtrip(obj)
def test_struct_pickle(): struct_scalar_expr = ibis.literal( OrderedDict([("fruit", "pear"), ("weight", 0)])) assert_pickle_roundtrip(struct_scalar_expr)