Ejemplo n.º 1
0
 def test_macro(self):
     surlex = '/year/<:Y>.html'
     regex = '/year/\d{4}\.html'
     self.assertEqual(surl(surlex), regex)
Ejemplo n.º 2
0
 def test_basic_capture1(self):
     surlex = '/<var>/'
     regex = '/(?P<var>.+)/'
     self.assertEqual(surl(surlex), regex)
Ejemplo n.º 3
0
 def test_basic_capture2(self):
     surlex = '/<product>/<option>.html'
     regex = '/(?P<product>.+)/(?P<option>.+)\.html'
     self.assertEqual(surl(surlex), regex)
Ejemplo n.º 4
0
 def test_regex2(self):
     surlex = r'/<=\d{5}$>'
     regex = r'/\d{5}$'
     self.assertEqual(surl(surlex), regex)
Ejemplo n.º 5
0
 def test_basic_capture1(self):
     surlex = '/<var>/'
     regex = '/(?P<var>.+)/'
     self.assertEqual(surl(surlex), regex)
Ejemplo n.º 6
0
 def test_regex_capture(self):
     surlex = '/<var=[0-9]*>/'
     regex = '/(?P<var>[0-9]*)/'
     self.assertEqual(surl(surlex), regex)
Ejemplo n.º 7
0
 def test_wildcard(self):
     surlex = '/foo/*.html'
     regex = '/foo/.*\.html'
     self.assertEqual(surl(surlex), regex)
Ejemplo n.º 8
0
 def test_optional(self):
     surlex = '/things/(<slug>/)'
     regex = '/things/((?P<slug>.+)/)?'
     self.assertEqual(surl(surlex), regex)
Ejemplo n.º 9
0
 def test_wildcard(self):
     surlex = '/foo/*.html'
     regex = '/foo/.*\.html'
     self.assertEqual(surl(surlex), regex)
Ejemplo n.º 10
0
 def test_custom_macro(self):
     register_macro('B', 'bar')
     surlex = '/foo/<:B>/'
     regex = '/foo/bar/'
     self.assertEqual(surl(surlex), regex)
Ejemplo n.º 11
0
 def test_regex_capture(self):
     surlex = '/<var=[0-9]*>/'
     regex = '/(?P<var>[0-9]*)/'
     self.assertEqual(surl(surlex), regex)
Ejemplo n.º 12
0
 def test_macro_capture(self):
     surlex = '/blog/<year:Y>.html'
     regex = '/blog/(?P<year>\d{4})\.html'
     self.assertEqual(surl(surlex), regex)
Ejemplo n.º 13
0
 def test_macro(self):
     surlex = '/year/<:Y>.html'
     regex = '/year/\d{4}\.html'
     self.assertEqual(surl(surlex), regex)
Ejemplo n.º 14
0
 def test_basic_capture2(self):
     surlex = '/<product>/<option>.html'
     regex = '/(?P<product>.+)/(?P<option>.+)\.html'
     self.assertEqual(surl(surlex), regex)
Ejemplo n.º 15
0
 def test_macro_capture(self):
     surlex = '/blog/<year:Y>.html'
     regex = '/blog/(?P<year>\d{4})\.html'
     self.assertEqual(surl(surlex), regex)
Ejemplo n.º 16
0
 def test_regex(self):
     surlex = '/anything/<=.*$>'
     regex = '/anything/.*$'
     self.assertEqual(surl(surlex), regex)
Ejemplo n.º 17
0
 def test_custom_macro(self):
     register_macro('B', 'bar')
     surlex = '/foo/<:B>/'
     regex = '/foo/bar/'
     self.assertEqual(surl(surlex), regex)
Ejemplo n.º 18
0
 def test_regex2(self):
     surlex = r'/<=\d{5}$>'
     regex = r'/\d{5}$'
     self.assertEqual(surl(surlex), regex)
Ejemplo n.º 19
0
 def test_optional(self):
     surlex = '/things/(<slug>/)'
     regex = '/things/((?P<slug>.+)/)?'
     self.assertEqual(surl(surlex), regex)
Ejemplo n.º 20
0
 def test_regex3(self):
     surlex = '<=\>>'
     regex = '>'
     self.assertEqual(surl(surlex), regex)
Ejemplo n.º 21
0
 def test_regex(self):
     surlex = '/anything/<=.*$>'
     regex = '/anything/.*$'
     self.assertEqual(surl(surlex), regex)
Ejemplo n.º 22
0
 def test_matches(self):
     for surlex, regex in self.matches:
         self.assertEqual(surl(surlex), regex)
Ejemplo n.º 23
0
 def test_regex3(self):
     surlex = '<=\>>'
     regex = '>'
     self.assertEqual(surl(surlex), regex)
Ejemplo n.º 24
0
 def test_matches(self):
     for surlex, regex in self.matches:
         self.assertEqual(surl(surlex), regex)