view urlmatch.txt @ 9:8d47894191a0

more stubbing of tests
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 27 Jun 2011 11:22:40 -0700
parents 64935a05afdb
children
line wrap: on
line source

urlmatch
========

Test basic diff functionality::

    >>> matcher = UrlMatcher()
    >>> matcher.diff('http://www.example.com', 'http://example.com')
    {'domain': [None, None, ('www', None)]}
    >>> matcher.diff('http://example.com', 'https://example.com')
    {'scheme': ('http', 'https')}

Test making a basic tree::

    >>> urlmatcher = URLmatcher()
    >>> urls = ['http://example.com/foo/bar.html',
    ...         'http://example.com/foo/baz.html',
    ...         'http://example.com/foo/fleem.html']
    >>> urlmatcher.add(*urls)
    >>> urlmatcher.tree()
    ['http://example.com/foo/': ['bar.html', 'baz.html', 'fleem.html']]
    
Now a more complex tree::

    >>> urlmatcher = URLmatcher()
    >>> urlmatcher.add(*['http://example.com/index.html',
    ...                  'https://example.com/,
    ...                  'http://gitcub.com/k0s'])
    >>> urlmatcher.tree()
    ['example.com': ['http://example.com/index.html', 'https://example.com'],