Skip to content

Conversation

@friedkeenan
Copy link
Member

@friedkeenan friedkeenan commented Feb 27, 2021

Motivation

Because #995 added a __getattr__ method to Mobject, all incorrect accesses to a mobject's attributes goes through that method, but the resulting error does not have an accompanying message (sorry). This fixes that.

Overview / Explanation for Changes

Adds an error message to the error raised at the end of __getattr__. It uses f"{self} ..." to take advantage of mobjects' custom representations, particularly with Text and Tex and such which include their content in their representation.

Oneline Summary of Changes

- More descriptive error when accessing an unhandled mobject attribute (:pr:`1059`)

Testing Status

This change shouldn't affect any tests.

Acknowledgements

Reviewer Checklist

  • Newly added functions/classes are either private or have a docstring
  • Newly added functions/classes have tests added and (optional) examples in the docs
  • Newly added documentation builds, looks correctly formatted, and adds no additional build warnings
  • The oneline summary has been included in the wiki

@friedkeenan friedkeenan added the pr:easy review There is nothing particular (i.e, it's about a general/small thing) to know for review! label Feb 27, 2021
@huguesdevimeux
Copy link
Member

Tests are failing for 3.8

And, do you mind adding a test for this?

@friedkeenan
Copy link
Member Author

friedkeenan commented Feb 27, 2021

Welp, tests should pass now, though now we don't take advantage of mobject representations. My bad for not testing what I thought would be an utterly simple change.

Also changed a test that was explicitly checking for an attribute error for a missing attribute so that it looks for the message too.

@huguesdevimeux huguesdevimeux self-requested a review February 27, 2021 08:56
@jsonvillanueva jsonvillanueva merged commit 60b240a into ManimCommunity:master Feb 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:easy review There is nothing particular (i.e, it's about a general/small thing) to know for review!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants