[Python-checkins] r53909 - sandbox/trunk/pep362/pep362_py3k_fodder.py sandbox/trunk/pep362/test_pep362.py

brett.cannon python-checkins at python.org
Sun Feb 25 17:47:19 CET 2007


Author: brett.cannon
Date: Sun Feb 25 17:47:17 2007
New Revision: 53909

Modified:
   sandbox/trunk/pep362/pep362_py3k_fodder.py
   sandbox/trunk/pep362/test_pep362.py
Log:
Add a unit test for the worst-case Py3K signature (currently fails).


Modified: sandbox/trunk/pep362/pep362_py3k_fodder.py
==============================================================================
--- sandbox/trunk/pep362/pep362_py3k_fodder.py	(original)
+++ sandbox/trunk/pep362/pep362_py3k_fodder.py	Sun Feb 25 17:47:17 2007
@@ -19,5 +19,6 @@
 def return_annotation() -> int:
     pass
 
-def all_args(a:int, (b, (c,)), *args:int, d, e, **kwargs) -> int:
+def all_args(a:int, (b, (c,)), d=0, (e, (f,))=(0, (0,)), *args:int,
+                g:int, h:int=8, **kwargs:int) -> int:
     pass

Modified: sandbox/trunk/pep362/test_pep362.py
==============================================================================
--- sandbox/trunk/pep362/test_pep362.py	(original)
+++ sandbox/trunk/pep362/test_pep362.py	Sun Feb 25 17:47:17 2007
@@ -305,6 +305,14 @@
         self.failUnlessEqual(binding, {'a':1})
         self.failUnlessRaises(pep362.BindError, sig.bind, 1)
 
+    @py3k_test
+    def test_all_args(self):
+        sig = pep362.Signature(pep362_py3k_fodder.all_args)
+        binding = sig.bind(0, (1, (2,)), 3, (4, (5,)), 6, g=7, i=9)
+        expected = {'a':0, 'b':1, 'c':2, 'd':3, 'e':4, 'f':5, 'g':7, 'h':8,
+                'i':9, 'args':(6,)}
+        self.failUnlessEqual(binding, expected)
+
     def test_too_many_arguments(self):
         # Only one argument should pair up with a parameter.
         sig = pep362.Signature(pep362_fodder.no_default_args)


More information about the Python-checkins mailing list