diff tests/test_uriutil.py @ 495:4284c673bb91

internal: Fix some edge-cases for splitting sub-URIs. A given URI may or may not have a trailing slash, regardless of the `trailing_slash` configuration setting. Add unit tests to check those cases.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 23 Jul 2015 22:11:59 -0700
parents d4321317beae
children e85f29b28b84
line wrap: on
line diff
--- a/tests/test_uriutil.py	Thu Jul 23 22:09:00 2015 -0700
+++ b/tests/test_uriutil.py	Thu Jul 23 22:11:59 2015 -0700
@@ -30,7 +30,8 @@
     ('/', ('/', 1), True),
     ('/2', ('/', 2), True),
     ('/foo/bar', ('/foo/bar', 1), True),
-    ('/foo/bar/2', ('/foo/bar', 2), True),
+    ('/foo/bar/', ('/foo/bar', 1), True),
+    ('/foo/bar/2/', ('/foo/bar', 2), True),
     ('/foo/bar.ext', ('/foo/bar.ext', 1), True),
     ('/foo/bar.ext/2', ('/foo/bar.ext', 2), True),
     ('/', ('/', 1), False),
@@ -53,7 +54,9 @@
 @pytest.mark.parametrize('uri, expected, pretty_urls', [
     ('/', ('/', 1), True),
     ('/2/', ('/', 2), True),
+    ('/foo/bar', ('/foo/bar/', 1), True),
     ('/foo/bar/', ('/foo/bar/', 1), True),
+    ('/foo/bar/2', ('/foo/bar/', 2), True),
     ('/foo/bar/2/', ('/foo/bar/', 2), True),
     ('/foo/bar.ext/', ('/foo/bar.ext/', 1), True),
     ('/foo/bar.ext/2/', ('/foo/bar.ext/', 2), True),
@@ -73,7 +76,9 @@
     ('/', ('/', 1), True),
     ('/2', ('/', 2), True),
     ('/foo/bar', ('/foo/bar', 1), True),
+    ('/foo/bar/', ('/foo/bar', 1), True),
     ('/foo/bar/2', ('/foo/bar', 2), True),
+    ('/foo/bar/2/', ('/foo/bar', 2), True),
     ('/foo/bar.ext', ('/foo/bar.ext', 1), True),
     ('/foo/bar.ext/2', ('/foo/bar.ext', 2), True),
     ('/', ('/', 1), False),