8000 improve tests · matplotlib/matplotlib@45e5bc7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 45e5bc7

Browse files
committed
improve tests
1 parent 527aa46 commit 45e5bc7

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4073,16 +4073,38 @@ def test_axline(fig_test, fig_ref):
40734073

40744074

40754075
@check_figures_equal()
4076-
def test_axline_transform(fig_test, fig_ref):
4076+
def test_axline_transaxes(fig_test, fig_ref):
40774077
ax = fig_test.subplots()
40784078
ax.set(xlim=(-1, 1), ylim=(-1, 1))
40794079
ax.axline_transaxes((0, 0), slope=1)
40804080
ax.axline_transaxes((1, 0.5), slope=1, color='C1')
4081+
ax.axline_transaxes((0.5, 0.5), slope=0, color='C2')
40814082

40824083
ax = fig_ref.subplots()
40834084
ax.set(xlim=(-1, 1), ylim=(-1, 1))
40844085
ax.plot([-1, 1], [-1, 1])
40854086
ax.plot([0, 1], [-1, 0], color='C1')
4087+
ax.plot([-1, 1], [0, 0], color='C2')
4088+
4089+
4090+
@check_figures_equal()
4091+
def test_axline_transaxes_panzoom(fig_test, fig_ref):
4092+
# test that it is robust against pan/zoom and
4093+
# figure resize after plotting
4094+
ax = fig_test.subplots()
4095+
ax.set(xlim=(-1, 1), ylim=(-1, 1))
4096+
ax.axline_transaxes((0, 0), slope=1)
4097+
ax.axline_transaxes((0.5, 0.5), slope=2, color='C1')
4098+
ax.axline_transaxes((0.5, 0.5), slope=0, color='C2')
4099+
ax.set(xlim=(0, 5), ylim=(0, 10))
4100+
fig_test.set_size_inches(3, 3)
4101+
4102+
ax = fig_ref.subplots()
4103+
ax.set(xlim=(0, 5), ylim=(0, 10))
4104+
fig_ref.set_size_inches(3, 3)
4105+
ax.plot([0, 5], [0, 5])
4106+
ax.plot([0, 5], [0, 10], color='C1')
4107+
ax.plot([0, 5], [5, 5], color='C2')
40864108

40874109

40884110
def test_axline_args():

0 commit comments

Comments
 (0)
0