Skip to content

Commit 787db12

Browse files
Added handle position checks to test_widgets.py
1 parent 2566eaa commit 787db12

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

lib/matplotlib/tests/test_widgets.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1107,17 +1107,38 @@ def test_range_slider(orientation):
11071107

11081108
slider.set_val((0.2, 0.6))
11091109
assert_allclose(slider.val, (0.2, 0.6))
1110+
if orientation == "vertical":
1111+
hpositions = [h.get_ydata()[0] for h in slider._handles]
1112+
else:
1113+
hpositions = [h.get_xdata()[0] for h in slider._handles]
1114+
assert_allclose(hpositions, (0.2, 0.6))
1115+
11101116
box = slider.poly.get_extents().transformed(ax.transAxes.inverted())
11111117
assert_allclose(box.get_points().flatten()[idx], [0.2, .25, 0.6, .75])
11121118

11131119
slider.set_val((0.2, 0.1))
11141120
assert_allclose(slider.val, (0.1, 0.2))
1121+
if orientation == "vertical":
1122+
hpositions = [h.get_ydata()[0] for h in slider._handles]
1123+
else:
1124+
hpositions = [h.get_xdata()[0] for h in slider._handles]
1125+
assert_allclose(hpositions, (0.1, 0.2))
11151126

11161127
slider.set_val((-1, 10))
11171128
assert_allclose(slider.val, (0, 1))
1129+
if orientation == "vertical":
1130+
hpositions = [h.get_ydata()[0] for h in slider._handles]
1131+
else:
1132+
hpositions = [h.get_xdata()[0] for h in slider._handles]
1133+
assert_allclose(hpositions, (0, 1))
11181134

11191135
slider.reset()
1120-
assert_allclose(slider.val, [0.1, 0.34])
1136+
assert_allclose(slider.val, (0.1, 0.34))
1137+
if orientation == "vertical":
1138+
hpositions = [h.get_ydata()[0] for h in slider._handles]
1139+
else:
1140+
hpositions = [h.get_xdata()[0] for h in slider._handles]
1141+
assert_allclose(hpositions, (0.1, 0.34))
11211142

11221143

11231144
def check_polygon_selector(event_sequence, expected_result, selections_count,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy