Skip to content

Commit 8b77974

Browse files
committed
unittest: test for allowing setting and getting the __dict__ for extensions of builtins
1 parent cd1f7bc commit 8b77974

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

graalpython/com.oracle.graal.python.test/src/tests/test_object.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ def assert_raises(err, fn, *args, **kwargs):
4747
assert raised
4848

4949

50+
def test_set_dict_attr_builtin_extension():
51+
class MyList(list):
52+
pass
53+
54+
lst = MyList()
55+
assert lst.__dict__ == {}
56+
lst.__dict__ = {'a': 9}
57+
assert lst.a == 9
58+
assert lst.__dict__ == {'a': 9}
59+
60+
5061
def test_set_dict_attr():
5162
o = object()
5263

@@ -81,7 +92,6 @@ def __getattr__(self, item):
8192
raise AttributeError
8293

8394
m1 = MyOtherClass()
84-
print()
8595

8696
def get_non_existing_attr():
8797
return m1.my_attr_2

0 commit comments

Comments
 (0)