@@ -47,7 +47,7 @@ tests/test_get_methods_used.py . [ 30%]
4747tests/test_ghost_col_issue.py . [ 31%]
4848tests/test_idioms.py ................. [ 37%]
4949tests/test_if_else.py ..... [ 39%]
50- tests/test_if_else_return_type.py . [ 39%]
50+ tests/test_if_else_return_type.py F [ 39%]
5151tests/test_incomplete_agg.py . [ 39%]
5252tests/test_join_check.py . [ 40%]
5353tests/test_join_effects.py . [ 40%]
@@ -117,6 +117,58 @@ tests/test_window_fns.py ..... [ 98%]
117117tests/test_with.py .. [ 99%]
118118tests/test_xicor.py .. [100%]
119119
120+ =================================== FAILURES ===================================
121+ ___________________________ test_if_else_return_type ___________________________
122+
123+ def test_if_else_return_type():
124+ pd = data_algebra.default_data_model.pd
125+ d = pd.DataFrame({
126+ 'x': [True, False, None],
127+ })
128+ ops = (
129+ descr(d=d)
130+ .extend({
131+ 'w': 'x.where(1.0, 2.0)',
132+ 'i': 'x.if_else(1.0, 2.0)',
133+ })
134+ )
135+ res = ops.transform(d)
136+ expect = pd.DataFrame({
137+ 'x': [True, False, None],
138+ 'w': [1.0, 2.0, 2.0],
139+ 'i': [1.0, 2.0, numpy.nan],
140+ })
141+ assert data_algebra.test_util.equivalent_frames(res, expect)
142+ assert str(res['w'].dtype) == 'float64'
143+ assert str(res['i'].dtype) == 'float64'
144+ > numpy.isnan(res) # when column types are wrong this threw in pyvteat test_KDD2009.py
145+
146+ tests/test_if_else_return_type.py:31:
147+ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
148+ ../../../opt/anaconda3/envs/ai_academy_3_9/lib/python3.9/site-packages/pandas/core/generic.py:2032: in __array_ufunc__
149+ return arraylike.array_ufunc(self, ufunc, method, *inputs, **kwargs)
150+ ../../../opt/anaconda3/envs/ai_academy_3_9/lib/python3.9/site-packages/pandas/core/arraylike.py:372: in array_ufunc
151+ result = mgr.apply(getattr(ufunc, method))
152+ ../../../opt/anaconda3/envs/ai_academy_3_9/lib/python3.9/site-packages/pandas/core/internals/managers.py:325: in apply
153+ applied = b.apply(f, **kwargs)
154+ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
155+
156+ self = ObjectBlock: slice(0, 1, 1), 1 x 3, dtype: object
157+ func = <method-wrapper '__call__' of numpy.ufunc object at 0x7fb3f81ee7c0>
158+ kwargs = {}
159+
160+ @final
161+ def apply(self, func, **kwargs) -> list[Block]:
162+ """
163+ apply the function to my values; return a block if we are not
164+ one
165+ """
166+ with np.errstate(all="ignore"):
167+ > result = func(self.values, **kwargs)
168+ E TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
169+
170+ ../../../opt/anaconda3/envs/ai_academy_3_9/lib/python3.9/site-packages/pandas/core/internals/blocks.py:382: TypeError
171+
120172---------- coverage: platform darwin, python 3.9.7-final-0 -----------
121173Name Stmts Miss Cover Missing
122174--------------------------------------------------------------------
@@ -152,5 +204,6 @@ data_algebra/util.py 140 29 79% 26, 51, 56, 61, 84-
152204--------------------------------------------------------------------
153205TOTAL 5669 712 87%
154206
155-
156- ======================= 282 passed in 437.13s (0:07:17) ========================
207+ =========================== short test summary info ============================
208+ FAILED tests/test_if_else_return_type.py::test_if_else_return_type - TypeErro...
209+ ================== 1 failed, 281 passed in 406.07s (0:06:46) ===================
0 commit comments