Mercurial > hg > urlmatch
comparison 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 |
comparison
equal
deleted
inserted
replaced
9:8d47894191a0 | 10:b02420253bfd |
---|---|
18 >>> sorted(matcher.match('example.com')) | 18 >>> sorted(matcher.match('example.com')) |
19 ['http://www.example.com/foo/bar/fleem', 'http://www.example.com/foo/blah', 'https://www.example.com/foo/'] | 19 ['http://www.example.com/foo/bar/fleem', 'http://www.example.com/foo/blah', 'https://www.example.com/foo/'] |
20 >>> sorted(matcher.match('example')) # -> example.* | 20 >>> sorted(matcher.match('example')) # -> example.* |
21 ['http://www.example.com/foo/bar/fleem', 'http://www.example.com/foo/blah', 'https://www.example.com/foo/', 'https://www.example.net/foo/'] | 21 ['http://www.example.com/foo/bar/fleem', 'http://www.example.com/foo/blah', 'https://www.example.com/foo/', 'https://www.example.net/foo/'] |
22 | 22 |
23 Test decomposition:: | 23 Test decomposition and recomposition:: |
24 | 24 |
25 >>> matcher = UrlMatcher() | 25 >>> matcher = UrlMatcher() |
26 >>> sorted(matcher.decompose('http://www.example.com/foo').items()) | 26 >>> decomposed = matcher.decompose('http://www.example.com/foo') |
27 >>> sorted(decomposed.items()) | |
27 [('domain', ['example', 'com', 'www']), ('path', ['foo']), ('scheme', 'http')] | 28 [('domain', ['example', 'com', 'www']), ('path', ['foo']), ('scheme', 'http')] |
29 >>> matcher.recompose(decomposed) | |
30 'http://www.example.com/foo' | |
28 | 31 |
29 Test url diffs:: | 32 Test url diffs:: |
30 | 33 |
31 >>> matcher = UrlMatcher() | 34 >>> matcher = UrlMatcher() |