summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_property.py
diff options
context:
space:
mode:
authorAlex-Blade <44120047+Alex-Blade@users.noreply.github.com>2022-02-16 07:07:34 (GMT)
committerGitHub <noreply@github.com>2022-02-16 07:07:34 (GMT)
commit0cb765b2cec9b020224af016a83bf35c45b71932 (patch)
treee56baf1ed502d969431a3721d58bfb683d9eb705 /Lib/test/test_property.py
parent4d8a515d193a4c9f3844704f974ddb870d7ee383 (diff)
downloadcpython-0cb765b2cec9b020224af016a83bf35c45b71932.zip
cpython-0cb765b2cec9b020224af016a83bf35c45b71932.tar.gz
cpython-0cb765b2cec9b020224af016a83bf35c45b71932.tar.bz2
bpo-46730: Add more info to @property AttributeError messages (GH-31311)
On `obj.read_only_property = x`, raise `AttributeError: property 'read_only_property' of 'A' object has no setter`.
Diffstat (limited to 'Lib/test/test_property.py')
-rw-r--r--Lib/test/test_property.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/test/test_property.py b/Lib/test/test_property.py
index 7f3813f..7d1c4a1 100644
--- a/Lib/test/test_property.py
+++ b/Lib/test/test_property.py
@@ -322,27 +322,27 @@ class _PropertyUnreachableAttribute:
cls.obj = cls.cls()
def test_get_property(self):
- with self.assertRaisesRegex(AttributeError, self._format_exc_msg("unreadable attribute")):
+ with self.assertRaisesRegex(AttributeError, self._format_exc_msg("has no getter")):
self.obj.foo
def test_set_property(self):
- with self.assertRaisesRegex(AttributeError, self._format_exc_msg("can't set attribute")):
+ with self.assertRaisesRegex(AttributeError, self._format_exc_msg("has no setter")):
self.obj.foo = None
def test_del_property(self):
- with self.assertRaisesRegex(AttributeError, self._format_exc_msg("can't delete attribute")):
+ with self.assertRaisesRegex(AttributeError, self._format_exc_msg("has no deleter")):
del self.obj.foo
class PropertyUnreachableAttributeWithName(_PropertyUnreachableAttribute, unittest.TestCase):
- msg_format = "^{} 'foo'$"
+ msg_format = r"^property 'foo' of 'PropertyUnreachableAttributeWithName\.cls' object {}$"
class cls:
foo = property()
class PropertyUnreachableAttributeNoName(_PropertyUnreachableAttribute, unittest.TestCase):
- msg_format = "^{}$"
+ msg_format = "^property of 'PropertyUnreachableAttributeNoName\.cls' object {}$"
class cls:
pass