diff options
author | Tim Graham <timograham@gmail.com> | 2016-05-30 09:44:33 -0400 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2016-05-30 09:50:02 -0400 |
commit | 16a842b3795ca78a5918538ab6b9f1afbd718f72 (patch) | |
tree | 6b1ad11de2d7cfa77749b8c42d4d47fd130285e2 /tests/admin_docs | |
parent | 995d09ead492a1c3d71d781c7846f622b3f71186 (diff) | |
download | django-16a842b3795ca78a5918538ab6b9f1afbd718f72.tar.gz |
Refs #26621 -- Added tests for admindocs.views.simplify_regex().
Diffstat (limited to 'tests/admin_docs')
-rw-r--r-- | tests/admin_docs/tests.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/admin_docs/tests.py b/tests/admin_docs/tests.py index ec35f92627..3d5955d680 100644 --- a/tests/admin_docs/tests.py +++ b/tests/admin_docs/tests.py @@ -3,7 +3,7 @@ import unittest from django.conf import settings from django.contrib.admindocs import utils -from django.contrib.admindocs.views import get_return_data_type +from django.contrib.admindocs.views import get_return_data_type, simplify_regex from django.contrib.auth.models import User from django.contrib.sites.models import Site from django.test import TestCase, modify_settings, override_settings @@ -123,6 +123,15 @@ class AdminDocViewTests(TestDataMixin, AdminDocsTestCase): finally: utils.docutils_is_available = True + def test_simplify_regex(self): + tests = ( + ('^a', '/a'), + ('^(?P<a>\w+)/b/(?P<c>\w+)/$', '/<a>/b/<c>/'), + ('^(?P<a>\w+)/b/(?P<c>\w+)$', '/<a>/b/<c>'), + ) + for pattern, output in tests: + self.assertEqual(simplify_regex(pattern), output) + @override_settings(TEMPLATES=[{ 'NAME': 'ONE', |