Skip to content

Commit 27645ee

Browse files
committed
Extend test 'PyDict_SetItem' by passing a mappingproxy.
1 parent 11a0752 commit 27645ee

File tree

1 file changed

+10
-2
lines changed
  • graalpython/com.oracle.graal.python.test/src/tests/cpyext

1 file changed

+10
-2
lines changed

graalpython/com.oracle.graal.python.test/src/tests/cpyext/test_dict.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ class SubDict(dict):
105105

106106

107107
ExampleDict = {}
108+
109+
108110
def fresh_dict():
109111
global ExampleDict
110112
ExampleDict = {}
@@ -120,10 +122,16 @@ def compile_module(self, name):
120122
# PyDict_SetItem
121123
test_PyDict_SetItem = CPyExtFunction(
122124
_reference_set_item,
123-
lambda: (({}, "a", "hello"), ({'a': "hello"}, "b", "world")),
125+
lambda: (
126+
({}, "a", "hello")
127+
, ({'a': "hello"}, "b", "world")
128+
# mappingproxy
129+
, (type(type.__dict__)({'a': "hello"}), "b", "world")
130+
),
124131
resultspec="i",
125132
argspec='OOO',
126133
arguments=("PyObject* dict", "PyObject* key", "PyObject* val"),
134+
cmpfunc=unhandled_error_compare
127135
)
128136

129137
# PyDict_GetItem
@@ -316,5 +324,5 @@ def compile_module(self, name):
316324
}
317325
}''',
318326
callfunction="wrap_PyDict_Update",
319-
cmpfunc=lambda cr,pr: (cr == pr or (isinstance(cr, BaseException) and type(cr) == type(pr))) and (ExampleDict.get("a") == 1 or len(ExampleDict) == 0)
327+
cmpfunc=lambda cr, pr: (cr == pr or (isinstance(cr, BaseException) and type(cr) == type(pr))) and (ExampleDict.get("a") == 1 or len(ExampleDict) == 0)
320328
)

0 commit comments

Comments
 (0)