summaryrefslogtreecommitdiff
path: root/tests/run/delete.pyx
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run/delete.pyx')
-rw-r--r--tests/run/delete.pyx18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/run/delete.pyx b/tests/run/delete.pyx
index ec0b6c71a..6127fa9f1 100644
--- a/tests/run/delete.pyx
+++ b/tests/run/delete.pyx
@@ -29,15 +29,33 @@ def del_item(L, o):
del L[o]
return L
+
@cython.test_assert_path_exists('//DelStatNode//IndexNode//NoneCheckNode')
def del_dict(dict D, o):
"""
>>> del_dict({1: 'a', 2: 'b'}, 1)
{2: 'b'}
+ >>> del_dict(None, 1) # doctest: +ELLIPSIS
+ Traceback (most recent call last):
+ TypeError: 'NoneType' object ...
"""
del D[o]
return D
+
+@cython.test_fail_if_path_exists('//DelStatNode//IndexNode//NoneCheckNode')
+def del_dict_ann(D: dict, o):
+ """
+ >>> del_dict_ann({1: 'a', 2: 'b'}, 1)
+ {2: 'b'}
+ >>> del_dict_ann(None, 1)
+ Traceback (most recent call last):
+ TypeError: Argument 'D' has incorrect type (expected dict, got NoneType)
+ """
+ del D[o]
+ return D
+
+
@cython.test_fail_if_path_exists('//NoneCheckNode')
def del_dict_from_literal(o):
"""