8000 TST: Check assertion when setting equal ticker limits. · matplotlib/matplotlib@c31783e · GitHub
[go: up one dir, main page]

Skip to content

Commit c31783e

Browse files
committed
TST: Check assertion when setting equal ticker limits.
1 parent 57e762f commit c31783e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/matplotlib/tests/test_ticker.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,12 @@ def test_ScalarFormatter_offset_value():
176176
formatter = ax.get_xaxis().get_major_formatter()
177177

178178
def check_offset_for(left, right, offset):
179-
ax.set_xlim(left, right)
179+
with warnings.catch_warnings(record=True) as w:
180+
warnings.filterwarnings('always', 'Attempting to set identical',
181+
UserWarning)
182+
ax.set_xlim(left, right)
183+
assert_equal(len(w), 1 if left == right else 0)
184+
180185
# Update ticks.
181186
next(ax.get_xaxis().iter_ticks())
182187
assert_equal(formatter.offset, offset)

0 commit comments

Comments
 (0)
0