Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions lib/matplotlib/tests/test_artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,26 @@ def test_setp():
assert sio.getvalue() == ' zorder: float\n'


def test_artist_set_invalid_property_raises():
"""
Test that set() raises AttributeError for invalid property names.
"""
line = mlines.Line2D([0, 1], [0, 1])

with pytest.raises(AttributeError, match="unexpected keyword argument"):
line.set(not_a_property=1)


def test_artist_set_duplicate_aliases_raises():
"""
Test that set() raises TypeError when both a property and its alias are provided.
"""
line = mlines.Line2D([0, 1], [0, 1])

with pytest.raises(TypeError, match="aliases of one another"):
line.set(lw=2, linewidth=3)


def test_None_zorder():
fig, ax = plt.subplots()
ln, = ax.plot(range(5), zorder=None)
Expand Down
Loading