Mercurial > hg > urlmatch
comparison tests/doctest.txt @ 5:6b99523536ee
tests work
| author | Jeff Hammel <jhammel@mozilla.com> |
|---|---|
| date | Fri, 17 Jun 2011 10:52:29 -0700 |
| parents | 20dde2687cfb |
| children | 0cd69fa6751c |
comparison
equal
deleted
inserted
replaced
| 4:23be092e6099 | 5:6b99523536ee |
|---|---|
| 1 Test urlmatch | 1 Test urlmatch |
| 2 ============= | 2 ============= |
| 3 | 3 |
| 4 The obligatory imports:: | 4 The obligatory imports:: |
| 5 | 5 |
| 6 >>> from urlmatcher import UrlMatcher | 6 >>> from urlmatch import UrlMatcher |
| 7 | 7 |
| 8 Test matching:: | 8 Test matching:: |
| 9 | 9 |
| 10 >>> matcher = UrlMatcher('http://www.example.com/foo/bar/fleem') | 10 >>> matcher = UrlMatcher('http://www.example.com/foo/bar/fleem') |
| 11 >>> matcher.add('http://www.example.com/foo/blah') | 11 >>> matcher.add('http://www.example.com/foo/blah') |
| 12 >>> matcher.add('https://www.example.com/foo/') | 12 >>> matcher.add('https://www.example.com/foo/') |
| 13 >>> matcher.add('https://www.example.net/foo/') | 13 >>> matcher.add('https://www.example.net/foo/') |
| 14 >>> sorted(matcher.match('example.com/foo/bar')) | 14 >>> sorted(matcher.match('example.com/foo/bar')) |
| 15 ['http://www.example.com/foo/bar/fleem', ] | 15 ['http://www.example.com/foo/bar/fleem'] |
| 16 >>> sorted(matcher.match('http://example.com/foo')) | 16 >>> sorted(matcher.match('http://example.com/foo')) |
| 17 ['http://www.example.com/foo/bar/fleem', 'http://www.example.com/foo/blah'] | |
| 17 >>> sorted(matcher.match('example.com')) | 18 >>> sorted(matcher.match('example.com')) |
| 18 >>> sorted(matcher.match('example')) | 19 ['http://www.example.com/foo/bar/fleem', 'http://www.example.com/foo/blah', 'https://www.example.com/foo/'] |
| 19 | 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/'] | |
| 20 | 22 |
| 21 Test url diffs:: | 23 Test url diffs:: |
| 22 | 24 |
| 23 >>> matcher = urlmatcher() | 25 >>> matcher = UrlMatcher() |
