From a3597be2949455b05c0c5752dab35ebc59dfc2b5 Mon Sep 17 00:00:00 2001 From: ianb Date: Wed, 18 May 2005 05:40:59 +0000 Subject: Fixed name clash; added tests for path items with converters --- paste/wareweb/tests/test_unpack.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'paste/wareweb/tests') diff --git a/paste/wareweb/tests/test_unpack.py b/paste/wareweb/tests/test_unpack.py index 560de03..b44b99b 100644 --- a/paste/wareweb/tests/test_unpack.py +++ b/paste/wareweb/tests/test_unpack.py @@ -1,4 +1,4 @@ -from paste.wareweb import unpack +from paste.wareweb import packing from paste.wareweb import cgifields from cStringIO import StringIO @@ -15,7 +15,7 @@ def test_functions(): yield function_test, a1, a2, a3, a4 def function_test(func, query, expect_args, expect_kw): - spec = unpack.FunctionArgSpec(func) + spec = packing.FunctionArgSpec(func) if '?' in query: path_info, query = query.split('?') else: @@ -28,7 +28,7 @@ def function_test(func, query, expect_args, expect_kw): 'wsgi.input': StringIO()}) try: args, kw = spec.unpack_args(path_parts, fields) - except unpack.HTTPBadRequest, e: + except packing.HTTPBadRequest, e: print fields print path_parts if not expect_kw and len(expect_args) == 1: @@ -95,3 +95,9 @@ def t3(arg1_path, arg2_path=None, x=None): @unpack_test('a=b', "Bad variable 'a': invalid literal for int(): b") def t4(a_list_int=[]): pass + +@unpack_test('/1/2', '1', 2) +@unpack_test('/xxx/5', 'xxx', 5) +@unpack_test('/1/x', 'Not enough parameters on the URL (expected 2 more path segments)') +def t5(first_path, second_int_path): + pass -- cgit v1.2.1