Skip to content

Commit 7b9c52e

Browse files
author
Sylvain MARIE
committed
Removed the locale related test, will be covered separately (issue pandas-dev#46319)
1 parent d3c319b commit 7b9c52e

File tree

1 file changed

+9
-19
lines changed

1 file changed

+9
-19
lines changed

pandas/tests/io/formats/test_format.py

+9-19
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,6 @@
4949
use_32bit_repr = is_platform_windows() or not IS64
5050

5151

52-
def get_local_am_pm():
53-
"""Return the AM and PM strings returned by strftime in current locale"""
54-
am_local = time(1).strftime("%p")
55-
pm_local = time(13).strftime("%p")
56-
return am_local, pm_local
57-
58-
5952
@pytest.fixture(params=["string", "pathlike", "buffer"])
6053
def filepath_or_buffer_id(request):
6154
"""
@@ -3198,26 +3191,23 @@ def test_period(self):
31983191
def test_period_custom(self):
31993192
# GH46252
32003193

3201-
# Get locale-specific reference
3202-
am_local, pm_local = get_local_am_pm()
3203-
32043194
# 3 digits
32053195
p = pd.period_range("2003-01-01 12:01:01.123", periods=2, freq="l")
3206-
formatted = p.format(date_format="%y %I:%M:%S%p (ms=%l us=%u ns=%n)")
3207-
assert formatted[0] == f"03 12:01:01{pm_local} (ms=123 us=123000 ns=123000000)"
3208-
assert formatted[1] == f"03 12:01:01{pm_local} (ms=124 us=124000 ns=124000000)"
3196+
formatted = p.format(date_format="%y %I:%M:%S (ms=%l us=%u ns=%n)")
3197+
assert formatted[0] == "03 12:01:01 (ms=123 us=123000 ns=123000000)"
3198+
assert formatted[1] == "03 12:01:01 (ms=124 us=124000 ns=124000000)"
32093199

32103200
# 6 digits
32113201
p = pd.period_range("2003-01-01 12:01:01.123456", periods=2, freq="u")
3212-
formatted = p.format(date_format="%y %I:%M:%S%p (ms=%l us=%u ns=%n)")
3213-
assert formatted[0] == f"03 12:01:01{pm_local} (ms=123 us=123456 ns=123456000)"
3214-
assert formatted[1] == f"03 12:01:01{pm_local} (ms=123 us=123457 ns=123457000)"
3202+
formatted = p.format(date_format="%y %I:%M:%S (ms=%l us=%u ns=%n)")
3203+
assert formatted[0] == "03 12:01:01 (ms=123 us=123456 ns=123456000)"
3204+
assert formatted[1] == "03 12:01:01 (ms=123 us=123457 ns=123457000)"
32153205

32163206
# 9 digits
32173207
p = pd.period_range("2003-01-01 12:01:01.123456789", periods=2, freq="n")
3218-
formatted = p.format(date_format="%y %I:%M:%S%p (ms=%l us=%u ns=%n)")
3219-
assert formatted[0] == f"03 12:01:01{pm_local} (ms=123 us=123456 ns=123456789)"
3220-
assert formatted[1] == f"03 12:01:01{pm_local} (ms=123 us=123456 ns=123456790)"
3208+
formatted = p.format(date_format="%y %I:%M:%S (ms=%l us=%u ns=%n)")
3209+
assert formatted[0] == "03 12:01:01 (ms=123 us=123456 ns=123456789)"
3210+
assert formatted[1] == "03 12:01:01 (ms=123 us=123456 ns=123456790)"
32213211

32223212
def test_period_tz(self):
32233213
"""Test formatting periods created from a datetime with timezone."""

0 commit comments

Comments
 (0)