Skip to content

Commit 646acfd

Browse files
committed
more assoc tests
1 parent 281436c commit 646acfd

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/test_arrow1.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,18 @@ def test_arrow_assoc_guard_table():
262262
res_wide = ops_b.replace_leaves({"data_frame": ops}).transform(d) # widens column def
263263
res_narrow = ops_b.transform(ops.transform(d)) # would want to match this
264264
assert len(res_wide.columns) != len(res_narrow.columns)
265+
# allowed
266+
ops_3 = TableDescription(column_names=['x'], table_name="zz").extend({"y": "x + 1"}) >> ops
267+
assert isinstance(ops_3, ViewRepresentation)
268+
res_3 = pd.DataFrame({"x": [1, 2]}) >> ops_3
269+
expect_3 = pd.DataFrame({"x": [1, 2], "y": [2, 3], "z": [3, 5]})
270+
assert data_algebra.test_util.equivalent_frames(res_3, expect_3)
271+
res_3_a = pd.DataFrame({"x": [1, 2]}) >> TableDescription(column_names=['x'], table_name="zz").extend({"y": "x + 1"}) >> ops
272+
assert data_algebra.test_util.equivalent_frames(res_3_a, expect_3)
273+
res_3_b = (pd.DataFrame({"x": [1, 2]}) >> TableDescription(column_names=['x'], table_name="zz").extend({"y": "x + 1"})) >> ops
274+
assert data_algebra.test_util.equivalent_frames(res_3_b, expect_3)
275+
res_3_c = pd.DataFrame({"x": [1, 2]}) >> (TableDescription(column_names=['x'], table_name="zz").extend({"y": "x + 1"}) >> ops)
276+
assert data_algebra.test_util.equivalent_frames(res_3_c, expect_3)
265277

266278

267279
def test_arrow_table_narrows():

0 commit comments

Comments
 (0)