Mercurial > hg > urlmatch
diff tests/doctest.txt @ 10:b02420253bfd default tip
add recomposition and a test for it
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Tue, 28 Jun 2011 18:39:18 -0700 |
parents | 0cd69fa6751c |
children |
line wrap: on
line diff
--- a/tests/doctest.txt Mon Jun 27 11:22:40 2011 -0700 +++ b/tests/doctest.txt Tue Jun 28 18:39:18 2011 -0700 @@ -20,11 +20,14 @@ >>> sorted(matcher.match('example')) # -> example.* ['http://www.example.com/foo/bar/fleem', 'http://www.example.com/foo/blah', 'https://www.example.com/foo/', 'https://www.example.net/foo/'] -Test decomposition:: +Test decomposition and recomposition:: >>> matcher = UrlMatcher() - >>> sorted(matcher.decompose('http://www.example.com/foo').items()) + >>> decomposed = matcher.decompose('http://www.example.com/foo') + >>> sorted(decomposed.items()) [('domain', ['example', 'com', 'www']), ('path', ['foo']), ('scheme', 'http')] + >>> matcher.recompose(decomposed) + 'http://www.example.com/foo' Test url diffs::