summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMike Burrows <mjb@asplake.co.uk>2010-02-10 16:33:59 +0000
committerMike Burrows <mjb@asplake.co.uk>2010-02-10 16:33:59 +0000
commit8a32d35f8b05a5e5845083ade999383f171fa4ca (patch)
treebf36ddb7914f76ba116175d377b7c9f3cbf36870 /tests
parent5251795380fe9695906d78bba6226b7b599cf00d (diff)
downloadroutes-8a32d35f8b05a5e5845083ade999383f171fa4ca.tar.gz
{.format} path components
--HG-- branch : trunk
Diffstat (limited to 'tests')
-rw-r--r--tests/test_functional/test_generation.py9
-rw-r--r--tests/test_functional/test_recognition.py10
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: