[pypy-commit] pypy translation-cleanup: Add test for ArgsFT.fixedunpack()

rlamy noreply at buildbot.pypy.org
Thu Oct 18 23:41:08 CEST 2012


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: translation-cleanup
Changeset: r58237:4789622b8d7c
Date: 2012-10-18 22:40 +0100
http://bitbucket.org/pypy/pypy/changeset/4789622b8d7c/

Log:	Add test for ArgsFT.fixedunpack()

	(it's used in pypy.annotation.description)

diff --git a/pypy/objspace/flow/test/test_argument.py b/pypy/objspace/flow/test/test_argument.py
--- a/pypy/objspace/flow/test/test_argument.py
+++ b/pypy/objspace/flow/test/test_argument.py
@@ -151,6 +151,20 @@
         assert args1.keywords is args.keywords
         assert args1.keywords_w is args.keywords_w
 
+    def test_fixedunpacked(self):
+        space = DummySpace()
+
+        args = ArgumentsForTranslation(space, [], ["k"], [1])
+        py.test.raises(ValueError, args.fixedunpack, 1)
+
+        args = ArgumentsForTranslation(space, ["a", "b"])
+        py.test.raises(ValueError, args.fixedunpack, 0)
+        py.test.raises(ValueError, args.fixedunpack, 1)
+        py.test.raises(ValueError, args.fixedunpack, 3)
+        py.test.raises(ValueError, args.fixedunpack, 4)
+
+        assert args.fixedunpack(2) == ['a', 'b']
+
     def test_unmatch_signature(self):
         space = DummySpace()
         args = make_arguments_for_translation(space, [1,2,3])


More information about the pypy-commit mailing list