summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2011-03-28 16:01:10 -0400
committerChris McDonough <chrism@plope.com>2011-03-28 16:01:10 -0400
commit3ce731d85f2d2d538a6302989fb77c285bdd12f8 (patch)
tree0f04b7c68c334494b7a00ab57ef6d88630df6112
parent560e6e5b7466cfb54e36a05b3855f8596170f07b (diff)
downloadpyramid-3ce731d85f2d2d538a6302989fb77c285bdd12f8.tar.gz
pyramid-3ce731d85f2d2d538a6302989fb77c285bdd12f8.tar.bz2
pyramid-3ce731d85f2d2d538a6302989fb77c285bdd12f8.zip
branch coverage
-rw-r--r--pyramid/tests/test_urldispatch.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/pyramid/tests/test_urldispatch.py b/pyramid/tests/test_urldispatch.py
index 82ecd2b79..a0401ba6b 100644
--- a/pyramid/tests/test_urldispatch.py
+++ b/pyramid/tests/test_urldispatch.py
@@ -241,7 +241,8 @@ class TestCompileRoute(unittest.TestCase):
{'baz':1, 'buz':2, 'traverse':u'/a/b'}), '/foo/1/biz/2/bar/a/b')
def test_with_bracket_star(self):
- matcher, generator = self._callFUT('/foo/{baz}/biz/{buz}/bar{remainder:.*}')
+ matcher, generator = self._callFUT(
+ '/foo/{baz}/biz/{buz}/bar{remainder:.*}')
self.assertEqual(matcher('/foo/baz/biz/buz/bar'),
{'baz':'baz', 'buz':'buz', 'remainder':''})
self.assertEqual(matcher('/foo/baz/biz/buz/bar/everything/else/here'),
@@ -271,6 +272,14 @@ class TestCompileRoute(unittest.TestCase):
self.assertEqual(generator({'baz':1, 'buz':2, 'bar': 'html'}),
'/foo/1/biz/2.html')
+ def test_mixed_newstyle_oldstyle_pattern_defaults_to_newstyle(self):
+ # pattern: '\\/foo\\/(?P<baz>abc)\\/biz\\/(?P<buz>[^/]+)\\/bar$'
+ # note presence of :abc in pattern (oldstyle match)
+ matcher, generator = self._callFUT('foo/{baz:abc}/biz/{buz}/bar')
+ self.assertEqual(matcher('/foo/abc/biz/buz/bar'),
+ {'baz':'abc', 'buz':'buz'})
+ self.assertEqual(generator({'baz':1, 'buz':2}), '/foo/1/biz/2/bar')
+
# XXX reenable after torturous_route_re replacement is found for
# Jython
## def test_custom_regex_with_embedded_squigglies(self):