Skip to content

Commit 74a6898

Browse files
authored
STYLE: Inconsistent namespace - scalar #39992 (#40218)
* Fix styling * revert
1 parent 8b03404 commit 74a6898

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

pandas/tests/scalar/test_na_scalar.py

+26-26
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def test_comparison_ops():
100100
def test_pow_special(value, asarray):
101101
if asarray:
102102
value = np.array([value])
103-
result = pd.NA ** value
103+
result = NA ** value
104104

105105
if asarray:
106106
result = result[0]
@@ -117,7 +117,7 @@ def test_pow_special(value, asarray):
117117
def test_rpow_special(value, asarray):
118118
if asarray:
119119
value = np.array([value])
120-
result = value ** pd.NA
120+
result = value ** NA
121121

122122
if asarray:
123123
result = result[0]
@@ -133,7 +133,7 @@ def test_rpow_special(value, asarray):
133133
def test_rpow_minus_one(value, asarray):
134134
if asarray:
135135
value = np.array([value])
136-
result = value ** pd.NA
136+
result = value ** NA
137137

138138
if asarray:
139139
result = result[0]
@@ -197,8 +197,8 @@ def test_arithmetic_ndarray(shape, all_arithmetic_functions):
197197
a = np.zeros(shape)
198198
if op.__name__ == "pow":
199199
a += 5
200-
result = op(pd.NA, a)
201-
expected = np.full(a.shape, pd.NA, dtype=object)
200+
result = op(NA, a)
201+
expected = np.full(a.shape, NA, dtype=object)
202202
tm.assert_numpy_array_equal(result, expected)
203203

204204

@@ -218,50 +218,50 @@ def test_series_isna():
218218

219219

220220
def test_ufunc():
221-
assert np.log(pd.NA) is pd.NA
222-
assert np.add(pd.NA, 1) is pd.NA
223-
result = np.divmod(pd.NA, 1)
224-
assert result[0] is pd.NA and result[1] is pd.NA
221+
assert np.log(NA) is NA
222+
assert np.add(NA, 1) is NA
223+
result = np.divmod(NA, 1)
224+
assert result[0] is NA and result[1] is NA
225225

226-
result = np.frexp(pd.NA)
227-
assert result[0] is pd.NA and result[1] is pd.NA
226+
result = np.frexp(NA)
227+
assert result[0] is NA and result[1] is NA
228228

229229

230230
def test_ufunc_raises():
231231
msg = "ufunc method 'at'"
232232
with pytest.raises(ValueError, match=msg):
233-
np.log.at(pd.NA, 0)
233+
np.log.at(NA, 0)
234234

235235

236236
def test_binary_input_not_dunder():
237237
a = np.array([1, 2, 3])
238-
expected = np.array([pd.NA, pd.NA, pd.NA], dtype=object)
239-
result = np.logaddexp(a, pd.NA)
238+
expected = np.array([NA, NA, NA], dtype=object)
239+
result = np.logaddexp(a, NA)
240240
tm.assert_numpy_array_equal(result, expected)
241241

242-
result = np.logaddexp(pd.NA, a)
242+
result = np.logaddexp(NA, a)
243243
tm.assert_numpy_array_equal(result, expected)
244244

245245
# all NA, multiple inputs
246-
assert np.logaddexp(pd.NA, pd.NA) is pd.NA
246+
assert np.logaddexp(NA, NA) is NA
247247

248-
result = np.modf(pd.NA, pd.NA)
248+
result = np.modf(NA, NA)
249249
assert len(result) == 2
250-
assert all(x is pd.NA for x in result)
250+
assert all(x is NA for x in result)
251251

252252

253253
def test_divmod_ufunc():
254254
# binary in, binary out.
255255
a = np.array([1, 2, 3])
256-
expected = np.array([pd.NA, pd.NA, pd.NA], dtype=object)
256+
expected = np.array([NA, NA, NA], dtype=object)
257257

258-
result = np.divmod(a, pd.NA)
258+
result = np.divmod(a, NA)
259259
assert isinstance(result, tuple)
260260
for arr in result:
261261
tm.assert_numpy_array_equal(arr, expected)
262262
tm.assert_numpy_array_equal(arr, expected)
263263

264-
result = np.divmod(pd.NA, a)
264+
result = np.divmod(NA, a)
265265
for arr in result:
266266
tm.assert_numpy_array_equal(arr, expected)
267267
tm.assert_numpy_array_equal(arr, expected)
@@ -286,17 +286,17 @@ def test_integer_hash_collision_set():
286286

287287
def test_pickle_roundtrip():
288288
# https://github.com/pandas-dev/pandas/issues/31847
289-
result = pickle.loads(pickle.dumps(pd.NA))
290-
assert result is pd.NA
289+
result = pickle.loads(pickle.dumps(NA))
290+
assert result is NA
291291

292292

293293
def test_pickle_roundtrip_pandas():
294-
result = tm.round_trip_pickle(pd.NA)
295-
assert result is pd.NA
294+
result = tm.round_trip_pickle(NA)
295+
assert result is NA
296296

297297

298298
@pytest.mark.parametrize(
299-
"values, dtype", [([1, 2, pd.NA], "Int64"), (["A", "B", pd.NA], "string")]
299+
"values, dtype", [([1, 2, NA], "Int64"), (["A", "B", NA], "string")]
300300
)
301301
@pytest.mark.parametrize("as_frame", [True, False])
302302
def test_pickle_roundtrip_containers(as_frame, values, dtype):

0 commit comments

Comments
 (0)