Skip to content

TST/CLN: Assorted #57199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pandas/tests/config/test_localization.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import pandas as pd

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

# Don't run any of these tests if we have no locales.
pytestmark = pytest.mark.skipif(not _all_locales, reason="Need locales")
Expand Down
9 changes: 5 additions & 4 deletions pandas/tests/frame/indexing/test_xs.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ def four_level_index_dataframe():


class TestXS:
def test_xs(
self, float_frame, datetime_frame, using_copy_on_write, warn_copy_on_write
):
float_frame_orig = float_frame.copy()
def test_xs(self, float_frame):
idx = float_frame.index[5]
xs = float_frame.xs(idx)
for item, value in xs.items():
Expand All @@ -48,6 +45,7 @@ def test_xs(
else:
assert value == float_frame[item][idx]

def test_xs_mixed(self):
# mixed-type xs
test_data = {"A": {"1": 1, "2": 2}, "B": {"1": "1", "2": "2", "3": "3"}}
frame = DataFrame(test_data)
Expand All @@ -56,11 +54,14 @@ def test_xs(
assert xs["A"] == 1
assert xs["B"] == "1"

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

def test_xs_other(self, float_frame, using_copy_on_write, warn_copy_on_write):
float_frame_orig = float_frame.copy()
# xs get column
series = float_frame.xs("A", axis=1)
expected = float_frame["A"]
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/indexes/datetimes/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ def test_dti_constructor_with_non_nano_now_today(self):

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

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