Exemple #1
0
 def test_keyword_arg(self):
     pattern = RegexURLPattern(r'^keyword/(?P<slug>\w+)/$', views.single_keyword_arg)
     data = urlviz.inspect_pattern(pattern)
     self.assertEqual(data['annotated_pattern'],
         'keyword/<span class="capturegroup">&lt;slug&gt;</span>/')
     self.assertEqual(data['normalized_pattern'], 'keyword/slug/')
     self.assertEqual(data['raw_pattern'], r'^keyword/(?P<slug>\w+)/$')
Exemple #2
0
 def test_positional_arg(self):
     pattern = RegexURLPattern(r'^positional/(\d+)/$', views.single_positional_arg)
     data = urlviz.inspect_pattern(pattern)
     self.assertEqual(data['annotated_pattern'],
         'positional/<span class="capturegroup">&lt;id&gt;</span>/')
     self.assertEqual(data['normalized_pattern'], 'positional/id/')
     self.assertEqual(data['raw_pattern'], r'^positional/(\d+)/$')
Exemple #3
0
 def test_inspect_pattern(self):
     data = urlviz.inspect_pattern(self.pattern)
     self.assertEqual(data['regex'], r'^test/$')
     self.assertEqual(data['name'], None)
     self.assertEqual(data['view_module'], 'alto.tests.views')
     self.assertEqual(data['view_name'], 'basic_view')
     self.assertEqual(data['prefix'], '')
     self.assertEqual(data['default_args'], '{}')
Exemple #4
0
 def test_inspect_pattern(self):
     data = urlviz.inspect_pattern(self.pattern)
     self.assertEqual(data['default_args'], str(self.args))
Exemple #5
0
 def test_inspect_pattern(self):
     data = urlviz.inspect_pattern(self.pattern)
     self.assertEqual(data['name'], 'test')
Exemple #6
0
 def test_inspect_pattern(self):
     data = urlviz.inspect_pattern(self.pattern)
     self.assertEqual(data['view_module'], 'alto.tests.views')
     self.assertEqual(data['view_name'], 'basic_view')