Skip to content

Commit 02bcfa0

Browse files
committed
TST: Add test that update_from works properly
1 parent df74949 commit 02bcfa0

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/matplotlib/tests/test_patches.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,3 +410,15 @@ def test_contains_points():
410410
expected = path.contains_points(points, transform, radius)
411411
result = ell.contains_points(points)
412412
assert np.all(result == expected)
413+
414+
415+
def test_update_from():
416+
# test that update_from properly sets the facecolor.
417+
fig, ax = plt.subplots()
418+
rect = Rectangle((0, 0), 1., 1., facecolor='magenta')
419+
rect2 = Rectangle((1., 0), 1., 1., facecolor='blue')
420+
ax.add_patch(rect)
421+
ax.add_patch(rect2)
422+
rect2.update_from(rect)
423+
rect2.set_alpha(0.8)
424+
assert rect2.get_facecolor() == (1., 0., 1., 0.8)

0 commit comments

Comments
 (0)