Skip to content

Commit e5e9603

Browse files
authored
TST/CLN: Assorted (#57199)
* Split test_xs * Remove unused variables * Bump up tolerance
1 parent 7736d4b commit e5e9603

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

pandas/tests/config/test_localization.py

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import pandas as pd
1616

1717
_all_locales = get_locales()
18-
_current_locale = locale.setlocale(locale.LC_ALL) # getlocale() is wrong, see GH#46595
1918

2019
# Don't run any of these tests if we have no locales.
2120
pytestmark = pytest.mark.skipif(not _all_locales, reason="Need locales")

pandas/tests/frame/indexing/test_xs.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ def four_level_index_dataframe():
3636

3737

3838
class TestXS:
39-
def test_xs(
40-
self, float_frame, datetime_frame, using_copy_on_write, warn_copy_on_write
41-
):
42-
float_frame_orig = float_frame.copy()
39+
def test_xs(self, float_frame):
4340
idx = float_frame.index[5]
4441
xs = float_frame.xs(idx)
4542
for item, value in xs.items():
@@ -48,6 +45,7 @@ def test_xs(
4845
else:
4946
assert value == float_frame[item][idx]
5047

48+
def test_xs_mixed(self):
5149
# mixed-type xs
5250
test_data = {"A": {"1": 1, "2": 2}, "B": {"1": "1", "2": "2", "3": "3"}}
5351
frame = DataFrame(test_data)
@@ -56,11 +54,14 @@ def test_xs(
5654
assert xs["A"] == 1
5755
assert xs["B"] == "1"
5856

57+
def test_xs_dt_error(self, datetime_frame):
5958
with pytest.raises(
6059
KeyError, match=re.escape("Timestamp('1999-12-31 00:00:00')")
6160
):
6261
datetime_frame.xs(datetime_frame.index[0] - BDay())
6362

63+
def test_xs_other(self, float_frame, using_copy_on_write, warn_copy_on_write):
64+
float_frame_orig = float_frame.copy()
6465
# xs get column
6566
series = float_frame.xs("A", axis=1)
6667
expected = float_frame["A"]

pandas/tests/indexes/datetimes/test_constructors.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1042,7 +1042,7 @@ def test_dti_constructor_with_non_nano_now_today(self):
10421042

10431043
# result may not exactly match [now, today] so we'll test it up to a tolerance.
10441044
# (it *may* match exactly due to rounding)
1045-
tolerance = pd.Timedelta(microseconds=1)
1045+
tolerance = pd.Timedelta(seconds=1)
10461046

10471047
diff0 = result[0] - now.as_unit("s")
10481048
assert diff0 >= pd.Timedelta(0), f"The difference is {diff0}"

0 commit comments

Comments
 (0)