Mercurial > piecrust2
view tests/test_uriutil.py @ 5:474c9882decf
Upgrade to Python 3.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 11 Aug 2014 22:36:47 -0700 |
parents | f485ba500df3 |
children | 62c7a97c8340 |
line wrap: on
line source
import pytest from piecrust.uriutil import UriInfo, parse_uri @pytest.mark.parametrize('routes, uri, expected', [ ({}, '/foo', None), ( {'/articles/%slug%': {'source': 'dummy'}}, '/articles/foo', UriInfo('', 'dummy', {'slug': 'foo'})), ( {'/foo/%bar%': {'source': 'foo'}, '/other/%one%-%two%': {'source': 'other'}}, '/other/some-thing', UriInfo('', 'other', {'one': 'some', 'two': 'thing'})) ]) def test_parse_uri(routes, uri, expected): if expected is not None: expected.uri = uri for pattern, args in routes.items(): if 'taxonomy' not in args: args['taxonomy'] = None actual = parse_uri(routes, uri) assert actual == expected