()
| 371 | |
| 372 | |
| 373 | def 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 | |
| 404 | def test_axline_small_slope(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…