MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_axline_setters

Function test_axline_setters

lib/matplotlib/tests/test_lines.py:373–401  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

371
372
373def test_axline_setters():
374 fig, ax = plt.subplots()
375 line1 = ax.axline((.1, .1), slope=0.6)
376 line2 = ax.axline((.1, .1), (.8, .4))
377 # Testing xy1, xy2 and slope setters.
378 # This should not produce an error.
379 line1.set_xy1((.2, .3))
380 line1.set_slope(2.4)
381 line2.set_xy1((.3, .2))
382 line2.set_xy2((.6, .8))
383 # Testing xy1, xy2 and slope getters.
384 # Should return the modified values.
385 assert line1.get_xy1() == (.2, .3)
386 assert line1.get_slope() == 2.4
387 assert line2.get_xy1() == (.3, .2)
388 assert line2.get_xy2() == (.6, .8)
389 with pytest.warns(mpl.MatplotlibDeprecationWarning):
390 line1.set_xy1(.2, .3)
391 with pytest.warns(mpl.MatplotlibDeprecationWarning):
392 line2.set_xy2(.6, .8)
393 # Testing setting xy2 and slope together.
394 # These test should raise a ValueError
395 with pytest.raises(ValueError,
396 match="Cannot set an 'xy2' value while 'slope' is set"):
397 line1.set_xy2(.2, .3)
398
399 with pytest.raises(ValueError,
400 match="Cannot set a 'slope' value while 'xy2' is set"):
401 line2.set_slope(3)
402
403
404def test_axline_small_slope():

Callers

nothing calls this directly

Calls 8

axlineMethod · 0.80
set_xy1Method · 0.80
set_slopeMethod · 0.80
set_xy2Method · 0.80
get_xy1Method · 0.80
get_slopeMethod · 0.80
get_xy2Method · 0.80
subplotsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…