示例#1
0
 def test_prefix(self):
     app_urls = [ url(r'/home', None),
                  url(r'/foo', None, name='foo')]
     mapper = Mapper([
                     url(r'^/$', None),
                     include('/app', app_urls),
                     url('help', None),
                     ])
     assert mapper.reverse('foo') == '/app/foo', mapper.reverse('foo')
示例#2
0
 def test_replacements(self):
     m = Mapper([
         url(r'^/{home}$', None, name='home1'),
     ], replacements={'home' : 'foo'})
     m.urls[0].apply_replacements(**{'home':'bar'})
     expected = '/foo'
     assert expected == m.reverse('home1')