()
| 838 | |
| 839 | |
| 840 | def test_minimized_rasterized(): |
| 841 | # This ensures that the rasterized content in the colorbars is |
| 842 | # only as thick as the colorbar, and doesn't extend to other parts |
| 843 | # of the image. See #5814. While the original bug exists only |
| 844 | # in Postscript, the best way to detect it is to generate SVG |
| 845 | # and then parse the output to make sure the two colorbar images |
| 846 | # are the same size. |
| 847 | from xml.etree import ElementTree |
| 848 | |
| 849 | np.random.seed(0) |
| 850 | data = np.random.rand(10, 10) |
| 851 | |
| 852 | fig, ax = plt.subplots(1, 2) |
| 853 | p1 = ax[0].pcolormesh(data) |
| 854 | p2 = ax[1].pcolormesh(data) |
| 855 | |
| 856 | plt.colorbar(p1, ax=ax[0]) |
| 857 | plt.colorbar(p2, ax=ax[1]) |
| 858 | |
| 859 | buff = io.BytesIO() |
| 860 | plt.savefig(buff, format='svg') |
| 861 | |
| 862 | buff = io.BytesIO(buff.getvalue()) |
| 863 | tree = ElementTree.parse(buff) |
| 864 | width = None |
| 865 | for image in tree.iter('image'): |
| 866 | if width is None: |
| 867 | width = image['width'] |
| 868 | else: |
| 869 | if image['width'] != width: |
| 870 | assert False |
| 871 | |
| 872 | |
| 873 | def test_load_from_url(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…