Skip to content

Commit 4609baf

Browse files
committed
Update tests for fixing 28021
1 parent 560c9a8 commit 4609baf

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

pandas/tests/plotting/test_datetimelike.py

+20-12
Original file line numberDiff line numberDiff line change
@@ -460,9 +460,8 @@ def test_get_finder(self):
460460
def test_finder_daily(self):
461461
day_lst = [10, 40, 252, 400, 950, 2750, 10000]
462462

463-
msg = "Period with BDay freq is deprecated"
464-
with tm.assert_produces_warning(FutureWarning, match=msg):
465-
xpl1 = xpl2 = [Period("1999-1-1", freq="B").ordinal] * len(day_lst)
463+
xpl1 = [7565, 7564, 7553, 7546, 7518, 7428, 7066]
464+
xpl2 = [7566, 7564, 7554, 7546, 7519, 7429, 7066]
466465
rs1 = []
467466
rs2 = []
468467
for n in day_lst:
@@ -484,7 +483,8 @@ def test_finder_daily(self):
484483
def test_finder_quarterly(self):
485484
yrs = [3.5, 11]
486485

487-
xpl1 = xpl2 = [Period("1988Q1").ordinal] * len(yrs)
486+
xpl1 = [68, 72]
487+
xpl2 = [72, 72]
488488
rs1 = []
489489
rs2 = []
490490
for n in yrs:
@@ -506,7 +506,8 @@ def test_finder_quarterly(self):
506506
def test_finder_monthly(self):
507507
yrs = [1.15, 2.5, 4, 11]
508508

509-
xpl1 = xpl2 = [Period("Jan 1988").ordinal] * len(yrs)
509+
xpl1 = [216, 216, 204, 204]
510+
xpl2 = [216, 216, 216, 204]
510511
rs1 = []
511512
rs2 = []
512513
for n in yrs:
@@ -536,8 +537,7 @@ def test_finder_monthly_long(self):
536537
assert rs == xp
537538

538539
def test_finder_annual(self):
539-
xp = [1987, 1988, 1990, 1990, 1995, 2020, 2070, 2170]
540-
xp = [Period(x, freq="Y").ordinal for x in xp]
540+
xp = [16, 16, 20, 20, 25, 50, 0, 0]
541541
rs = []
542542
for nyears in [5, 10, 19, 49, 99, 199, 599, 1001]:
543543
rng = period_range("1987", periods=nyears, freq="Y")
@@ -559,9 +559,8 @@ def test_finder_minutely(self):
559559
ser.plot(ax=ax)
560560
xaxis = ax.get_xaxis()
561561
rs = xaxis.get_majorticklocs()[0]
562-
xp = Period("1/1/1999", freq="Min").ordinal
563562

564-
assert rs == xp
563+
assert rs == 15248880
565564

566565
def test_finder_hourly(self):
567566
nhours = 23
@@ -571,9 +570,8 @@ def test_finder_hourly(self):
571570
ser.plot(ax=ax)
572571
xaxis = ax.get_xaxis()
573572
rs = xaxis.get_majorticklocs()[0]
574-
xp = Period("1/1/1999", freq="h").ordinal
575573

576-
assert rs == xp
574+
assert rs == 254206
577575

578576
def test_gaps(self):
579577
ts = Series(
@@ -1541,7 +1539,15 @@ def test_plot_outofbounds_datetime(self):
15411539
ax.plot(values)
15421540

15431541
def test_format_timedelta_ticks_narrow(self):
1544-
expected_labels = [f"00:00:00.0000000{i:0>2d}" for i in np.arange(10)]
1542+
expected_labels = [
1543+
"-1 days 23:59:59.999999998",
1544+
"00:00:00.000000000",
1545+
"00:00:00.000000002",
1546+
"00:00:00.000000004",
1547+
"00:00:00.000000006",
1548+
"00:00:00.000000008",
1549+
"00:00:00.000000010",
1550+
]
15451551

15461552
rng = timedelta_range("0", periods=10, freq="ns")
15471553
df = DataFrame(np.random.default_rng(2).standard_normal((len(rng), 3)), rng)
@@ -1556,6 +1562,7 @@ def test_format_timedelta_ticks_narrow(self):
15561562

15571563
def test_format_timedelta_ticks_wide(self):
15581564
expected_labels = [
1565+
"-2 days 20:13:20",
15591566
"00:00:00",
15601567
"1 days 03:46:40",
15611568
"2 days 07:33:20",
@@ -1565,6 +1572,7 @@ def test_format_timedelta_ticks_wide(self):
15651572
"6 days 22:40:00",
15661573
"8 days 02:26:40",
15671574
"9 days 06:13:20",
1575+
"10 days 10:00:00",
15681576
]
15691577

15701578
rng = timedelta_range("0", periods=10, freq="1 d")

0 commit comments

Comments
 (0)