@@ -747,16 +747,26 @@ class TestTypeCasting:
747747 @pytest .mark .parametrize ("op" , ["+" , "-" , "*" , "**" , "/" ])
748748 # maybe someday... numexpr has too many upcasting rules now
749749 # chain(*(np.core.sctypes[x] for x in ['uint', 'int', 'float']))
750- @pytest .mark .parametrize ("dt" , [np .float32 , np .float64 ])
751750 @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 )
754757 left , right = left_right
755758 s = f"{ left } { op } { right } "
756759 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 )
760770
761771
762772# -------------------------------------
0 commit comments