@@ -747,16 +747,26 @@ class TestTypeCasting:
747
747
@pytest .mark .parametrize ("op" , ["+" , "-" , "*" , "**" , "/" ])
748
748
# maybe someday... numexpr has too many upcasting rules now
749
749
# chain(*(np.core.sctypes[x] for x in ['uint', 'int', 'float']))
750
- @pytest .mark .parametrize ("dt" , [np .float32 , np .float64 ])
751
750
@pytest .mark .parametrize ("left_right" , [("df" , "3" ), ("3" , "df" )])
752
- def test_binop_typecasting (self , engine , parser , op , dt , left_right ):
753
- df = DataFrame (np .random .default_rng (2 ).standard_normal ((5 , 3 )), dtype = dt )
751
+ def test_binop_typecasting (
752
+ self , engine , parser , op , complex_or_float_dtype , left_right , request
753
+ ):
754
+ # GH#21374
755
+ dtype = complex_or_float_dtype
756
+ df = DataFrame (np .random .default_rng (2 ).standard_normal ((5 , 3 )), dtype = dtype )
754
757
left , right = left_right
755
758
s = f"{ left } { op } { right } "
756
759
res = pd .eval (s , engine = engine , parser = parser )
757
- assert df .values .dtype == dt
758
- assert res .values .dtype == dt
759
- tm .assert_frame_equal (res , eval (s ))
760
+ if dtype == "complex64" and engine == "numexpr" :
761
+ mark = pytest .mark .xfail (
762
+ reason = "numexpr issue with complex that are upcast "
763
+ "to complex 128 "
764
+ "https://github.com/pydata/numexpr/issues/492"
765
+ )
766
+ request .applymarker (mark )
767
+ assert df .values .dtype == dtype
768
+ assert res .values .dtype == dtype
769
+ tm .assert_frame_equal (res , eval (s ), check_exact = False )
760
770
761
771
762
772
# -------------------------------------
0 commit comments