@@ -564,8 +564,6 @@ def test_df_div_zero_series_does_not_commute(self):
564
564
res2 = df / ser
565
565
assert not res .fillna (0 ).equals (res2 .fillna (0 ))
566
566
567
-
568
-
569
567
# ------------------------------------------------------------------
570
568
# Mod By Zero
571
569
@@ -857,35 +855,47 @@ def test_modulo_zero_int(self):
857
855
result = 0 % s
858
856
expected = Series ([np .nan , 0.0 ])
859
857
tm .assert_series_equal (result , expected )
860
-
858
+
861
859
def test_np_array_mul_ea_array_returns_extensionarray ():
862
860
np_array = np .array ([1 , 2 , 3 , 4 , 5 ], dtype = tm .SIGNED_INT_NUMPY_DTYPES [0 ])
863
861
ea_array = pd .array ([1 , 2 , 3 , 4 , 5 ], dtype = tm .SIGNED_INT_EA_DTYPES [0 ])
864
862
result = np_array * ea_array
865
863
tm .assert_isinstance (result , type (ea_array ))
866
- tm .assert_equal (result , pd .array ([1 , 4 , 9 , 16 , 25 ], dtype = tm .SIGNED_INT_EA_DTYPES [0 ]))
867
- tm .assert_equal (result , pd .array ([1 , 4 , 9 , 16 , 25 ], dtype = tm .SIGNED_INT_EA_DTYPES [0 ]))
864
+ tm .assert_equal (
865
+ result , pd .array ([1 , 4 , 9 , 16 , 25 ], dtype = tm .SIGNED_INT_EA_DTYPES [0 ])
866
+ )
867
+ tm .assert_equal (
868
+ result , pd .array ([1 , 4 , 9 , 16 , 25 ], dtype = tm .SIGNED_INT_EA_DTYPES [0 ])
869
+ )
868
870
869
871
def test_df_mul_np_and_ea_array_shape_and_errors ():
870
872
df = pd .DataFrame (np .arange (50 ).reshape (10 , 5 )).notna ().values
871
- NP_array = pd .array ([i for i in range (10 )], dtype = tm .SIGNED_INT_NUMPY_DTYPES [0 ]).reshape (10 , 1 )
872
- EA_array = pd .array ([i for i in range (10 )], dtype = tm .SIGNED_INT_EA_DTYPES [0 ]).reshape (10 , 1 )
873
-
873
+ NP_array = pd .array (
874
+ [i for i in range (10 )], dtype = tm .SIGNED_INT_NUMPY_DTYPES [0 ]
875
+ ).reshape (10 , 1 )
876
+ EA_array = pd .array (
877
+ [i for i in range (10 )], dtype = tm .SIGNED_INT_EA_DTYPES [0 ]
878
+ ).reshape (10 , 1 )
879
+
874
880
result_np = df * NP_array
875
881
tm .assert_isinstance (result_np , np .ndarray )
876
882
tm .assert_equal (result_np .shape , (10 , 5 ))
877
883
878
884
with tm .assert_raises (TypeError ):
879
- _ = df * EA_array
885
+ _ = df * EA_array
880
886
881
887
def test_non_1d_ea_raises_typeerror ():
882
- ea_array = pd .array ([1 , 2 , 3 , 4 , 5 ], dtype = tm .SIGNED_INT_EA_DTYPES [0 ]).reshape (5 , 1 )
883
- np_array = np .array ([1 , 2 , 3 , 4 , 5 ], dtype = tm .SIGNED_INT_NUMPY_DTYPES [0 ]).reshape (5 , 1 )
888
+ ea_array = pd .array ([1 , 2 , 3 , 4 , 5 ], dtype = tm .SIGNED_INT_EA_DTYPES [0 ]).reshape (
889
+ 5 , 1
890
+ )
891
+ np_array = np .array (
892
+ [1 , 2 , 3 , 4 , 5 ], dtype = tm .SIGNED_INT_NUMPY_DTYPES [0 ]
893
+ ).reshape (5 , 1 )
884
894
885
895
with tm .assert_raises (TypeError ):
886
896
_ = ea_array * np_array
887
897
with tm .assert_raises (TypeError ):
888
- _ = np_array * ea_array
898
+ _ = np_array * ea_array
889
899
890
900
891
901
class TestAdditionSubtraction :
0 commit comments