test for some problematic **kw use cases
authorStefan Behnel <scoder@users.berlios.de>
Fri, 8 Feb 2008 12:26:34 +0000 (13:26 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Fri, 8 Feb 2008 12:26:34 +0000 (13:26 +0100)
tests/run/kwargproblems.pyx [new file with mode: 0644]

diff --git a/tests/run/kwargproblems.pyx b/tests/run/kwargproblems.pyx
new file mode 100644 (file)
index 0000000..1632eb9
--- /dev/null
@@ -0,0 +1,24 @@
+__doc__ = """
+    >>> d = {1 : 2}
+    >>> test(**d)
+    Traceback (most recent call last):
+    TypeError: test() keywords must be strings
+    >>> d
+    {1: 2}
+
+    >>> d = {}
+    >>> test(**d)
+    {'arg': 3}
+    >>> d
+    {}
+
+    >>> d = {'arg' : 2}
+    >>> test(**d)
+    {'arg': 3}
+    >>> d
+    {'arg': 2}
+"""
+
+def test(**kw):
+    kw['arg'] = 3
+    return kw