()
| 1686 | |
| 1687 | |
| 1688 | def test_deepcopy(): |
| 1689 | fig1, ax = plt.subplots() |
| 1690 | ax.plot([0, 1], [2, 3]) |
| 1691 | ax.set_yscale('log') |
| 1692 | |
| 1693 | fig2 = copy.deepcopy(fig1) |
| 1694 | |
| 1695 | # Make sure it is a new object |
| 1696 | assert fig2.axes[0] is not ax |
| 1697 | # And that the axis scale got propagated |
| 1698 | assert fig2.axes[0].get_yscale() == 'log' |
| 1699 | # Update the deepcopy and check the original isn't modified |
| 1700 | fig2.axes[0].set_yscale('linear') |
| 1701 | assert ax.get_yscale() == 'log' |
| 1702 | |
| 1703 | # And test the limits of the axes don't get propagated |
| 1704 | ax.set_xlim(1e-1, 1e2) |
| 1705 | # Draw these to make sure limits are updated |
| 1706 | fig1.draw_without_rendering() |
| 1707 | fig2.draw_without_rendering() |
| 1708 | |
| 1709 | assert ax.get_xlim() == (1e-1, 1e2) |
| 1710 | assert fig2.axes[0].get_xlim() == (0, 1) |
| 1711 | |
| 1712 | |
| 1713 | def test_unpickle_with_device_pixel_ratio(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…