Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

More descriptive error when accessing an unhandled mobject attribute (#1059)

friedkeenan60b240a49d9a
diff --git a/manim/mobject/mobject.py b/manim/mobject/mobject.py
index ab4f9b329..1bac90198 100644
--- a/manim/mobject/mobject.py
+++ b/manim/mobject/mobject.py
@@ -352,7 +352,7 @@ class Mobject(Container):
return types.MethodType(setter, self)
# Unhandled attribute, therefore error
- raise AttributeError
+ raise AttributeError(f"{type(self).__name__} object has no attribute '{attr}'")
@property
def width(self):
diff --git a/tests/test_get_set.py b/tests/test_get_set.py
index 47d1852d6..e74af412e 100644
--- a/tests/test_get_set.py
+++ b/tests/test_get_set.py
@@ -36,5 +36,5 @@ def test_set_compat_layer():
def test_nonexistent_attr():
m = Mobject()
- with pytest.raises(AttributeError):
+ with pytest.raises(AttributeError, match="object has no attribute"):
m.test