Skip to content

Commit

Permalink
add test case for pythongh-103272
Browse files Browse the repository at this point in the history
  • Loading branch information
sunmy2019 committed Apr 7, 2023
1 parent efb0a2c commit d1f461f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Lib/test/test_descr.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
xxsubtype = None



class OperatorsTest(unittest.TestCase):

def __init__(self, *args, **kwargs):
Expand Down Expand Up @@ -5003,6 +5004,26 @@ class Child(Parent):
gc.collect()
self.assertEqual(Parent.__subclasses__(), [])

def test_getattribute(self):
# add test case for gh-103272
class A:
def __init__(self) -> None:
self.bar = 0

def __getattribute__(self, name):
return super().__getattribute__(name)

def __getattr__(self, name):
if self.bar == 0:
raise ValueError

@property
def foo(self):
return self.__getattr__("foo")

with self.assertRaises(ValueError):
A().foo


class DictProxyTests(unittest.TestCase):
def setUp(self):
Expand Down

0 comments on commit d1f461f

Please sign in to comment.