Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7f60002

Browse filesBrowse files
authored
Merge pull request #16350 from pharshalp/improved_tests
TST: Improved test (getting rid of image comparison test for test_titletwiny)
2 parents 18ed621 + c484312 commit 7f60002
Copy full SHA for 7f60002

File tree

Expand file treeCollapse file tree

2 files changed

+11
-10
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+11
-10
lines changed
Binary file not shown.

‎lib/matplotlib/tests/test_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_axes.py
+11-10Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6023,18 +6023,19 @@ def test_axisbelow():
60236023
ax.set_axisbelow(setting)
60246024

60256025

6026-
@image_comparison(['titletwiny.png'], style='mpl20')
60276026
def test_titletwiny():
6028-
# Remove this line when this test image is regenerated.
6029-
plt.rcParams['text.kerning_factor'] = 6
6030-
6031-
# Test that title is put above xlabel if xlabel at top
6032-
fig, ax = plt.subplots()
6033-
fig.subplots_adjust(top=0.8)
6027+
plt.style.use('mpl20')
6028+
fig, ax = plt.subplots(dpi=72)
60346029
ax2 = ax.twiny()
6035-
ax.set_xlabel('Xlabel')
6036-
ax2.set_xlabel('Xlabel2')
6037-
ax.set_title('Title')
6030+
xlabel2 = ax2.set_xlabel('Xlabel2')
6031+
title = ax.set_title('Title')
6032+
fig.canvas.draw()
6033+
renderer = fig.canvas.get_renderer()
6034+
# ------- Test that title is put above Xlabel2 (Xlabel2 at top) ----------
6035+
bbox_y0_title = title.get_window_extent(renderer).y0 # bottom of title
6036+
bbox_y1_xlabel2 = xlabel2.get_window_extent(renderer).y1 # top of xlabel2
6037+
y_diff = bbox_y0_title - bbox_y1_xlabel2
6038+
assert np.isclose(y_diff, 3)
60386039

60396040

60406041
def test_titlesetpos():

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.