diff --git a/lib/matplotlib/tests/test_legend.py b/lib/matplotlib/tests/test_legend.py index 5e8c1f139872..458b13788504 100644 --- a/lib/matplotlib/tests/test_legend.py +++ b/lib/matplotlib/tests/test_legend.py @@ -16,6 +16,7 @@ import matplotlib.transforms as mtransforms import matplotlib.collections as mcollections from matplotlib.legend_handler import HandlerTuple +import matplotlib.legend as mlegend import inspect @@ -423,6 +424,22 @@ def test_nanscatter(): ax.grid(True) +def test_legend_repeatcheckok(): + fig, ax = plt.subplots() + ax.scatter(0.0, 1.0, color='k', marker='o', label='test') + ax.scatter(0.5, 0.0, color='r', marker='v', label='test') + hl = ax.legend() + hand, lab = mlegend._get_legend_handles_labels([ax]) + assert len(lab) == 2 + fig, ax = plt.subplots() + ax.scatter(0.0, 1.0, color='k', marker='o', label='test') + ax.scatter(0.5, 0.0, color='k', marker='v', label='test') + hl = ax.legend() + hand, lab = mlegend._get_legend_handles_labels([ax]) + assert len(lab) == 1 + + + @image_comparison(baseline_images=['not_covering_scatter'], extensions=['png']) def test_not_covering_scatter(): colors = ['b', 'g', 'r']