-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Add tests for invalid properties and duplicate aliases in Artist.set #31041
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests for invalid properties and duplicate aliases in Artist.set #31041
Conversation
|
Hi @story645 , Can you please review. |
|
Is their context for this change? Like a discussion in a PR or something? I'm unclear what problem it's fixing given there wasn't a coverage failure. |
|
There wasn’t any recent coverage failure behind this change. The goal is just to make the current behavior explicit, setp already raises an AttributeError when an invalid property name is passed, but there wasn’t a test that directly checked this. |
|
If we completely remove the specific error within In [4]: line.set_not_a_property(1)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[4], line 1
----> 1 line.set_not_a_property(1)
AttributeError: 'Line2D' object has no attribute 'set_not_a_property'So we still get an As discussed in #30979, the |
|
Thank you for the clarification. I’ll rework the tests accordingly and push an update. |
|
Thanks @aditya-singh597. I'm going to mark this as "draft" for now. Please mark it as "ready for review" when you are ready. In the meantime, if you need help, feel free to ask questions here. Or you may prefer to ask them in our incubator chat. |
|
Sure. I'll mark it ready for review when I'm done. |
|
Thanks @aditya-singh597 and congratulations on your first Matplotlib PR 🎉 Hopefully we will hear from you again. |
|
@rcomer |
PR Summary
As mentioned in #30979, set is not tested directly even though it is used in many places.
These tests lock in the current behaviour:
-passing an invalid property name raises an AttributeError, and
-providing both a property and its alias (for example lw and linewidth) raises a TypeError.
The behaviour already exists at runtime; these tests just make sure it doesn’t change by accident.
PR checklist