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