mirror of
https://github.com/python/cpython.git
synced 2025-10-02 13:22:19 +00:00
gh-103272: regression test for getattr exception in property (GH-103336)
(cherry picked from commit 5d7d86f2fd
)
Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
This commit is contained in:
parent
1b1f0164cb
commit
b8d1623f73
1 changed files with 13 additions and 0 deletions
|
@ -4999,6 +4999,19 @@ order (MRO) for bases """
|
||||||
gc.collect()
|
gc.collect()
|
||||||
self.assertEqual(Parent.__subclasses__(), [])
|
self.assertEqual(Parent.__subclasses__(), [])
|
||||||
|
|
||||||
|
def test_attr_raise_through_property(self):
|
||||||
|
# add test case for gh-103272
|
||||||
|
class A:
|
||||||
|
def __getattr__(self, name):
|
||||||
|
raise ValueError("FOO")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def foo(self):
|
||||||
|
return self.__getattr__("asdf")
|
||||||
|
|
||||||
|
with self.assertRaisesRegex(ValueError, "FOO"):
|
||||||
|
A().foo
|
||||||
|
|
||||||
|
|
||||||
class DictProxyTests(unittest.TestCase):
|
class DictProxyTests(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue