Skip to content

Commit 1d8b32e

Browse files
committed
rebuild and retest
1 parent 7e9bbdb commit 1d8b32e

File tree

6 files changed

+75
-11
lines changed

6 files changed

+75
-11
lines changed

build/lib/data_algebra/test_util.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,9 @@ def check_transform_on_handles(
166166
cols_used = ops.columns_used()
167167
table_name = [k for k in cols_used.keys()][0]
168168
data = {table_name: data}
169-
170169
assert isinstance(data, dict)
170+
n_tables = len(data)
171+
assert n_tables > 0
171172
if local_data_model is None:
172173
local_data_model = data_algebra.default_data_model
173174
assert isinstance(ops, ViewRepresentation)
@@ -210,14 +211,29 @@ def check_transform_on_handles(
210211
):
211212
raise ValueError("Pandas transform result did not match expect")
212213
# try on empty inputs
213-
empty_map = {k: v.iloc[range(0), :].reset_index(drop=True) for k, v in data.items()}
214+
empty_map = {k: v.iloc[range(0), :].reset_index(drop=True, inplace=False) for k, v in data.items()}
214215
empty_res = ops.eval(empty_map)
215216
assert local_data_model.is_appropriate_data_instance(empty_res)
216217
assert set(empty_res.columns) == set(res.columns)
217218
if empty_produces_empty:
218219
assert empty_res.shape[0] == 0
219220
else:
220221
assert empty_res.shape[0] > 0
222+
# try on combinations of empty and original
223+
if n_tables == 2:
224+
keys = [k for k in data.keys()]
225+
partial_maps = [
226+
{
227+
keys[0]: data[keys[0]].reset_index(drop=True, inplace=False),
228+
keys[1]: data[keys[1]],
229+
},
230+
{
231+
keys[0]: data[keys[0]],
232+
keys[1]: data[keys[1]].reset_index(drop=True, inplace=False),
233+
},
234+
]
235+
for pm in partial_maps:
236+
ops.eval(pm)
221237
# try any db paths
222238
if db_handles is not None:
223239
for db_handle in db_handles:

coverage.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ data_algebra/pandas_base.py 309 32 90%
115115
data_algebra/pandas_model.py 18 3 83%
116116
data_algebra/parse_by_lark.py 143 26 82%
117117
data_algebra/python3_lark.py 1 0 100%
118-
data_algebra/test_util.py 195 37 81%
118+
data_algebra/test_util.py 202 37 82%
119119
data_algebra/util.py 86 6 93%
120120
----------------------------------------------------------
121-
TOTAL 4804 853 82%
121+
TOTAL 4811 853 82%
122122

123123

124-
============================= 210 passed in 16.93s =============================
124+
============================= 210 passed in 16.73s =============================

data_algebra/test_util.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,9 @@ def check_transform_on_handles(
166166
cols_used = ops.columns_used()
167167
table_name = [k for k in cols_used.keys()][0]
168168
data = {table_name: data}
169-
170169
assert isinstance(data, dict)
170+
n_tables = len(data)
171+
assert n_tables > 0
171172
if local_data_model is None:
172173
local_data_model = data_algebra.default_data_model
173174
assert isinstance(ops, ViewRepresentation)
@@ -210,14 +211,29 @@ def check_transform_on_handles(
210211
):
211212
raise ValueError("Pandas transform result did not match expect")
212213
# try on empty inputs
213-
empty_map = {k: v.iloc[range(0), :].reset_index(drop=True) for k, v in data.items()}
214+
empty_map = {k: v.iloc[range(0), :].reset_index(drop=True, inplace=False) for k, v in data.items()}
214215
empty_res = ops.eval(empty_map)
215216
assert local_data_model.is_appropriate_data_instance(empty_res)
216217
assert set(empty_res.columns) == set(res.columns)
217218
if empty_produces_empty:
218219
assert empty_res.shape[0] == 0
219220
else:
220221
assert empty_res.shape[0] > 0
222+
# try on combinations of empty and original
223+
if n_tables == 2:
224+
keys = [k for k in data.keys()]
225+
partial_maps = [
226+
{
227+
keys[0]: data[keys[0]].reset_index(drop=True, inplace=False),
228+
keys[1]: data[keys[1]],
229+
},
230+
{
231+
keys[0]: data[keys[0]],
232+
keys[1]: data[keys[1]].reset_index(drop=True, inplace=False),
233+
},
234+
]
235+
for pm in partial_maps:
236+
ops.eval(pm)
221237
# try any db paths
222238
if db_handles is not None:
223239
for db_handle in db_handles:
125 Bytes
Binary file not shown.

dist/data_algebra-0.8.0.tar.gz

115 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)