diff options
author | Mike Burrows <mjb@asplake.co.uk> | 2010-02-10 16:33:59 +0000 |
---|---|---|
committer | Mike Burrows <mjb@asplake.co.uk> | 2010-02-10 16:33:59 +0000 |
commit | 8a32d35f8b05a5e5845083ade999383f171fa4ca (patch) | |
tree | bf36ddb7914f76ba116175d377b7c9f3cbf36870 /tests | |
parent | 5251795380fe9695906d78bba6226b7b599cf00d (diff) | |
download | routes-8a32d35f8b05a5e5845083ade999383f171fa4ca.tar.gz |
{.format} path components
--HG--
branch : trunk
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_functional/test_generation.py | 9 | ||||
-rw-r--r-- | tests/test_functional/test_recognition.py | 10 |
2 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_functional/test_generation.py b/tests/test_functional/test_generation.py index 7c2d2ba..9bff54a 100644 --- a/tests/test_functional/test_generation.py +++ b/tests/test_functional/test_generation.py @@ -626,6 +626,15 @@ class TestGeneration(unittest.TestCase): eq_('/2007/test.xml,ja', m.generate(year=2007, slug='test', format='xml', locale='ja')) eq_(None, m.generate(year=2007, format='html')) + def test_dot_format_args(self): + for minimization in [False, True]: + m = Mapper(explicit=True) + m.minimization=minimization + m.connect('/songs/{title}{.format}') + + eq_('/songs/my-way', m.generate(title='my-way')) + eq_('/songs/my-way.mp3', m.generate(title='my-way', format='mp3')) + if __name__ == '__main__': unittest.main() else: diff --git a/tests/test_functional/test_recognition.py b/tests/test_functional/test_recognition.py index c606beb..9dcc861 100644 --- a/tests/test_functional/test_recognition.py +++ b/tests/test_functional/test_recognition.py @@ -929,6 +929,16 @@ class TestRecognition(unittest.TestCase): m.match('') assert_raises(RoutesException, call_func) + def test_dot_format_args(self): + for minimization in [False, True]: + m = Mapper(explicit=True) + m.minimization=minimization + m.connect('/songs/{title}{.format}') + + eq_({'title': 'my-way', 'format': None}, m.match('/songs/my-way')) + eq_({'title': 'my-way', 'format': 'mp3'}, m.match('/songs/my-way.mp3')) + + if __name__ == '__main__': unittest.main() else: |