Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c09bef2

Browse files
committed
Test for patch color override warnings
1 parent 4b179b9 commit c09bef2

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

lib/matplotlib/tests/test_patches.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from numpy.testing import assert_almost_equal, assert_array_equal
66
import pytest
77

8-
from matplotlib.patches import Polygon, Rectangle, FancyArrowPatch
8+
from matplotlib.patches import Patch, Polygon, Rectangle, FancyArrowPatch
99
from matplotlib.testing.decorators import image_comparison, check_figures_equal
1010
from matplotlib.transforms import Bbox
1111
import matplotlib.pyplot as plt
@@ -563,3 +563,11 @@ def test_degenerate_polygon():
563563
point = [0, 0]
564564
correct_extents = Bbox([point, point]).extents
565565
assert np.all(Polygon([point]).get_extents().extents == correct_extents)
566+
567+
568+
@pytest.mark.parametrize('kwarg', ('edgecolor', 'facecolor'))
569+
def test_color_override_warning(kwarg):
570+
with pytest.warns(UserWarning,
571+
match="Setting the 'color' property will override "
572+
"the edgecolor or facecolor properties."):
573+
Patch(color='black', **{kwarg: 'black'})

0 commit comments

Comments
 (0)