gh-77757: replace exception wrapping by PEP-678 notes in typeobject's __set_name__ (#103402)

This commit is contained in:
Irit Katriel 2023-04-11 11:53:06 +01:00 committed by GitHub
parent e071f00aae
commit 55c99d97e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 55 additions and 41 deletions

View file

@ -2980,7 +2980,7 @@ class TestCachedProperty(unittest.TestCase):
def test_reuse_different_names(self):
"""Disallow this case because decorated function a would not be cached."""
with self.assertRaises(RuntimeError) as ctx:
with self.assertRaises(TypeError) as ctx:
class ReusedCachedProperty:
@py_functools.cached_property
def a(self):
@ -2989,7 +2989,7 @@ class TestCachedProperty(unittest.TestCase):
b = a
self.assertEqual(
str(ctx.exception.__context__),
str(ctx.exception),
str(TypeError("Cannot assign the same cached_property to two different names ('a' and 'b')."))
)