diff options
| author | ianb <devnull@localhost> | 2005-05-18 05:40:59 +0000 |
|---|---|---|
| committer | ianb <devnull@localhost> | 2005-05-18 05:40:59 +0000 |
| commit | a3597be2949455b05c0c5752dab35ebc59dfc2b5 (patch) | |
| tree | 73d9ea15414c87027fcb9d736646d2b460212eea /paste | |
| parent | 91c1a89badb25a740d3228ff5f2a61205f584e6a (diff) | |
| download | paste-a3597be2949455b05c0c5752dab35ebc59dfc2b5.tar.gz | |
Fixed name clash; added tests for path items with converters
Diffstat (limited to 'paste')
| -rw-r--r-- | paste/wareweb/__init__.py | 2 | ||||
| -rw-r--r-- | paste/wareweb/packing.py (renamed from paste/wareweb/unpack.py) | 0 | ||||
| -rw-r--r-- | paste/wareweb/tests/test_unpack.py | 12 |
3 files changed, 10 insertions, 4 deletions
diff --git a/paste/wareweb/__init__.py b/paste/wareweb/__init__.py index d82d368..f94de14 100644 --- a/paste/wareweb/__init__.py +++ b/paste/wareweb/__init__.py @@ -1,5 +1,5 @@ from servlet import * -from unpack import * +from packing import * from dispatch import * from notify import * diff --git a/paste/wareweb/unpack.py b/paste/wareweb/packing.py index a2b3217..a2b3217 100644 --- a/paste/wareweb/unpack.py +++ b/paste/wareweb/packing.py 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 |
