Skip to content

Commit 60b240a

Browse files
authored
More descriptive error when accessing an unhandled mobject attribute (#1059)
* More descriptive error when accessing an unhandled mobject attribute * Fix tests, stop taking advantage of mobject representations
1 parent 9b02aea commit 60b240a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

manim/mobject/mobject.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ def setter(self, value):
352352
return types.MethodType(setter, self)
353353

354354
# Unhandled attribute, therefore error
355-
raise AttributeError
355+
raise AttributeError(f"{type(self).__name__} object has no attribute '{attr}'")
356356

357357
@property
358358
def width(self):

tests/test_get_set.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ def test_set_compat_layer():
3636
def test_nonexistent_attr():
3737
m = Mobject()
3838

39-
with pytest.raises(AttributeError):
39+
with pytest.raises(AttributeError, match="object has no attribute"):
4040
m.test

0 commit comments

Comments
 (0)