Skip to content

Commit f0c9157

Browse files
committed
TST: fix test class methods and lint in test_numeric.py
1 parent 08e0e37 commit f0c9157

File tree

1 file changed

+8
-20
lines changed

1 file changed

+8
-20
lines changed

pandas/tests/arithmetic/test_numeric.py

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -855,42 +855,30 @@ def test_modulo_zero_int(self):
855855
result = 0 % s
856856
expected = Series([np.nan, 0.0])
857857
tm.assert_series_equal(result, expected)
858-
859-
def test_np_array_mul_ea_array_returns_extensionarray():
858+
859+
def test_np_array_mul_ea_array_returns_extensionarray(self):
860860
np_array = np.array([1, 2, 3, 4, 5], dtype=tm.SIGNED_INT_NUMPY_DTYPES[0])
861861
ea_array = pd.array([1, 2, 3, 4, 5], dtype=tm.SIGNED_INT_EA_DTYPES[0])
862862
result = np_array * ea_array
863863
tm.assert_isinstance(result, type(ea_array))
864864
tm.assert_equal(
865865
result, pd.array([1, 4, 9, 16, 25], dtype=tm.SIGNED_INT_EA_DTYPES[0])
866866
)
867-
tm.assert_equal(
868-
result, pd.array([1, 4, 9, 16, 25], dtype=tm.SIGNED_INT_EA_DTYPES[0])
869-
)
870867

871-
def test_df_mul_np_and_ea_array_shape_and_errors():
868+
def test_df_mul_np_and_ea_array_shape_and_errors(self):
872869
df = pd.DataFrame(np.arange(50).reshape(10, 5)).notna().values
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-
870+
NP_array = pd.array(list(range(10)), dtype=tm.SIGNED_INT_NUMPY_DTYPES[0]).reshape(10, 1)
871+
EA_array = pd.array(list(range(10)), dtype=tm.SIGNED_INT_EA_DTYPES[0]).reshape(10, 1)
880872
result_np = df * NP_array
881873
tm.assert_isinstance(result_np, np.ndarray)
882874
tm.assert_equal(result_np.shape, (10, 5))
883875

884876
with tm.assert_raises(TypeError):
885877
_ = df * EA_array
886878

887-
def test_non_1d_ea_raises_typeerror():
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)
879+
def test_non_1d_ea_raises_typeerror(self):
880+
ea_array = pd.array([1, 2, 3, 4, 5], dtype=tm.SIGNED_INT_EA_DTYPES[0]).reshape(5, 1)
881+
np_array = np.array([1, 2, 3, 4, 5], dtype=tm.SIGNED_INT_NUMPY_DTYPES[0]).reshape(5, 1)
894882

895883
with tm.assert_raises(TypeError):
896884
_ = ea_array * np_array

0 commit comments

Comments
 (0)