Test that Text artists with labels raise a warning
()
| 640 | |
| 641 | |
| 642 | def test_text_nohandler_warning(): |
| 643 | """Test that Text artists with labels raise a warning""" |
| 644 | fig, ax = plt.subplots() |
| 645 | ax.plot([0], label="mock data") |
| 646 | ax.text(x=0, y=0, s="text", label="label") |
| 647 | with pytest.warns(UserWarning) as record: |
| 648 | ax.legend() |
| 649 | assert len(record) == 1 |
| 650 | |
| 651 | # this should _not_ warn: |
| 652 | f, ax = plt.subplots() |
| 653 | ax.pcolormesh(np.random.uniform(0, 1, (10, 10))) |
| 654 | with warnings.catch_warnings(): |
| 655 | warnings.simplefilter("error") |
| 656 | ax.get_legend_handles_labels() |
| 657 | |
| 658 | |
| 659 | def test_empty_bar_chart_with_legend(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…