| 557 | |
| 558 | |
| 559 | def test_invalid_figure_add_axes(): |
| 560 | fig = plt.figure() |
| 561 | with pytest.raises(TypeError, |
| 562 | match="missing 1 required positional argument: 'rect'"): |
| 563 | fig.add_axes() |
| 564 | |
| 565 | with pytest.raises(ValueError): |
| 566 | fig.add_axes((.1, .1, .5, np.nan)) |
| 567 | |
| 568 | with pytest.raises(TypeError, match="multiple values for argument 'rect'"): |
| 569 | fig.add_axes((0, 0, 1, 1), rect=[0, 0, 1, 1]) |
| 570 | |
| 571 | fig2, ax = plt.subplots() |
| 572 | with pytest.raises(ValueError, |
| 573 | match="The Axes must have been created in the present " |
| 574 | "figure"): |
| 575 | fig.add_axes(ax) |
| 576 | |
| 577 | fig2.delaxes(ax) |
| 578 | with pytest.raises(TypeError, match=r"add_axes\(\) takes 1 positional arguments"): |
| 579 | fig2.add_axes(ax, "extra positional argument") |
| 580 | |
| 581 | with pytest.raises(TypeError, match=r"add_axes\(\) takes 1 positional arguments"): |
| 582 | fig.add_axes((0, 0, 1, 1), "extra positional argument") |
| 583 | |
| 584 | |
| 585 | def test_subplots_shareax_loglabels(): |