def test_non_reversible(self):
# URLSpecs are non-reversible if they include non-constant
# regex features outside capturing groups. Currently, this is
# only strictly enforced for backslash-escaped character
# classes.
paths = [
r'^/api/v\d+/foo/(\w+)$',
]
for path in paths:
# A URLSpec can still be created even if it cannot be reversed.
url_spec = url(path, None)
try:
result = url_spec.reverse()
self.fail("did not get expected exception when reversing %s. "
"result: %s" % (path, result))
except ValueError:
pass
评论列表
文章目录