diff options
| author | Chris McDonough <chrism@agendaless.com> | 2010-07-30 01:19:46 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2010-07-30 01:19:46 +0000 |
| commit | 523132fe530f3ed19316c569351b6d0e3539c5e0 (patch) | |
| tree | d47f039c3111ed23664d53ef17ecbc3a0d747601 /repoze/bfg/tests | |
| parent | baa6347612783c936c2bd081d5ec90e6c3011a02 (diff) | |
| download | pyramid-523132fe530f3ed19316c569351b6d0e3539c5e0.tar.gz pyramid-523132fe530f3ed19316c569351b6d0e3539c5e0.tar.bz2 pyramid-523132fe530f3ed19316c569351b6d0e3539c5e0.zip | |
cm
Diffstat (limited to 'repoze/bfg/tests')
| -rw-r--r-- | repoze/bfg/tests/test_urldispatch.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/repoze/bfg/tests/test_urldispatch.py b/repoze/bfg/tests/test_urldispatch.py index c5fa37758..89454e63b 100644 --- a/repoze/bfg/tests/test_urldispatch.py +++ b/repoze/bfg/tests/test_urldispatch.py @@ -230,9 +230,11 @@ class TestCompileRoute(unittest.TestCase): self.assertRaises(URLDecodeError, matcher, '/%FF%FE%8B%00') class TestCompileRouteMatchFunctional(unittest.TestCase): - def matches(self, pattern, path, result): + def matches(self, pattern, path, expected): from repoze.bfg.urldispatch import _compile_route - self.assertEqual(_compile_route(pattern)[0](path), result) + matcher = _compile_route(pattern)[0] + result = matcher(path) + self.assertEqual(result, expected) def generates(self, pattern, dict, result): from repoze.bfg.urldispatch import _compile_route @@ -244,9 +246,12 @@ class TestCompileRouteMatchFunctional(unittest.TestCase): self.matches('/', '/foo', None) self.matches('/foo/', '/foo', None) self.matches('/:x', '', None) + self.matches('/:x', '/', None) + self.matches('/abc/:def', '/abc/', None) + import pdb; pdb.set_trace() + self.matches('/abc/:def:baz', '/abc/bleep', None) # bad pattern self.matches('', '/', {}) self.matches('/', '/', {}) - self.matches('/:x', '/', {'x':''}) self.matches('/:x', '/a', {'x':'a'}) self.matches('zzz/:x', '/zzz/abc', {'x':'abc'}) self.matches('zzz/:x*traverse', '/zzz/abc', {'x':'abc', 'traverse':()}) |
