()
| 654 | |
| 655 | |
| 656 | def test_concise_converter_stays(): |
| 657 | # This test demonstrates problems introduced by gh-23417 (reverted in gh-25278) |
| 658 | # In particular, downstream libraries like Pandas had their designated converters |
| 659 | # overridden by actions like setting xlim (or plotting additional points using |
| 660 | # stdlib/numpy dates and string date representation, which otherwise work fine with |
| 661 | # their date converters) |
| 662 | # While this is a bit of a toy example that would be unusual to see it demonstrates |
| 663 | # the same ideas (namely having a valid converter already applied that is desired) |
| 664 | # without introducing additional subclasses. |
| 665 | # See also discussion at gh-25219 for how Pandas was affected |
| 666 | x = [datetime.datetime(2000, 1, 1), datetime.datetime(2020, 2, 20)] |
| 667 | y = [0, 1] |
| 668 | fig, ax = plt.subplots() |
| 669 | ax.plot(x, y) |
| 670 | # Bypass Switchable date converter |
| 671 | conv = mdates.ConciseDateConverter() |
| 672 | with pytest.warns(UserWarning, match="already has a converter"): |
| 673 | ax.xaxis.set_converter(conv) |
| 674 | assert ax.xaxis.units is None |
| 675 | ax.set_xlim(*x) |
| 676 | assert ax.xaxis.get_converter() == conv |
| 677 | |
| 678 | |
| 679 | def test_offset_changes(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…