Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f8071e8

Browse files
committed
Test with plot too
1 parent cec9c33 commit f8071e8

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -779,18 +779,20 @@ def test_nonfinite_limits():
779779
ax.plot(x, y)
780780

781781

782-
def test_limits_empty_data():
782+
@pytest.mark.parametrize('plot_fun, lims',
783+
[[plt.plot, (14610.0, 14974.0)],
784+
[plt.scatter, (14591.8, 14992.2)]])
785+
def test_limits_empty_data(plot_fun, lims):
783786
# Check that plotting empty data doesn't change autoscaling of dates
784787
x = np.arange("2010-01-01", "2011-01-01", dtype="datetime64[D]")
785-
lims = (14591.8, 14992.2)
786788

787789
fig, ax = plt.subplots()
788-
ax.scatter(x, np.arange(len(x)))
790+
plot_fun(x, np.arange(len(x)))
789791
assert ax.get_xlim() == lims
790792

791793
fig, ax = plt.subplots()
792-
ax.scatter([], [])
793-
ax.scatter(x, np.arange(len(x)))
794+
plot_fun([], [])
795+
plot_fun(x, np.arange(len(x)))
794796
assert ax.get_xlim() == lims
795797

796798

0 commit comments

Comments
 (0)