mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Refs #27392 -- Removed "Tests that", "Ensures that", etc. from test docstrings.
This commit is contained in:
@@ -12,20 +12,18 @@ from .urls import some_view
|
||||
@override_settings(ROOT_URLCONF='resolve_url.urls')
|
||||
class ResolveUrlTests(SimpleTestCase):
|
||||
"""
|
||||
Tests for the ``resolve_url`` function.
|
||||
Tests for the resolve_url() function.
|
||||
"""
|
||||
|
||||
def test_url_path(self):
|
||||
"""
|
||||
Tests that passing a URL path to ``resolve_url`` will result in the
|
||||
same url.
|
||||
Passing a URL path to resolve_url() results in the same url.
|
||||
"""
|
||||
self.assertEqual('/something/', resolve_url('/something/'))
|
||||
|
||||
def test_relative_path(self):
|
||||
"""
|
||||
Tests that passing a relative URL path to ``resolve_url`` will result
|
||||
in the same url.
|
||||
Passing a relative URL path to resolve_url() results in the same url.
|
||||
"""
|
||||
self.assertEqual('../', resolve_url('../'))
|
||||
self.assertEqual('../relative/', resolve_url('../relative/'))
|
||||
@@ -34,31 +32,30 @@ class ResolveUrlTests(SimpleTestCase):
|
||||
|
||||
def test_full_url(self):
|
||||
"""
|
||||
Tests that passing a full URL to ``resolve_url`` will result in the
|
||||
same url.
|
||||
Passing a full URL to resolve_url() results in the same url.
|
||||
"""
|
||||
url = 'http://example.com/'
|
||||
self.assertEqual(url, resolve_url(url))
|
||||
|
||||
def test_model(self):
|
||||
"""
|
||||
Tests that passing a model to ``resolve_url`` will result in
|
||||
``get_absolute_url`` being called on that model instance.
|
||||
Passing a model to resolve_url() results in get_absolute_url() being
|
||||
called on that model instance.
|
||||
"""
|
||||
m = UnimportantThing(importance=1)
|
||||
self.assertEqual(m.get_absolute_url(), resolve_url(m))
|
||||
|
||||
def test_view_function(self):
|
||||
"""
|
||||
Tests that passing a view function to ``resolve_url`` will result in
|
||||
the URL path mapping to that view name.
|
||||
Passing a view function to resolve_url() results in the URL path
|
||||
mapping to that view name.
|
||||
"""
|
||||
resolved_url = resolve_url(some_view)
|
||||
self.assertEqual('/some-url/', resolved_url)
|
||||
|
||||
def test_lazy_reverse(self):
|
||||
"""
|
||||
Tests that passing the result of reverse_lazy is resolved to a real URL
|
||||
Passing the result of reverse_lazy is resolved to a real URL
|
||||
string.
|
||||
"""
|
||||
resolved_url = resolve_url(reverse_lazy('some-view'))
|
||||
@@ -67,22 +64,22 @@ class ResolveUrlTests(SimpleTestCase):
|
||||
|
||||
def test_valid_view_name(self):
|
||||
"""
|
||||
Tests that passing a view name to ``resolve_url`` will result in the
|
||||
URL path mapping to that view.
|
||||
Passing a view name to resolve_url() results in the URL path mapping
|
||||
to that view.
|
||||
"""
|
||||
resolved_url = resolve_url('some-view')
|
||||
self.assertEqual('/some-url/', resolved_url)
|
||||
|
||||
def test_domain(self):
|
||||
"""
|
||||
Tests that passing a domain to ``resolve_url`` returns the same domain.
|
||||
Passing a domain to resolve_url() returns the same domain.
|
||||
"""
|
||||
self.assertEqual(resolve_url('example.com'), 'example.com')
|
||||
|
||||
def test_non_view_callable_raises_no_reverse_match(self):
|
||||
"""
|
||||
Tests that passing a non-view callable into ``resolve_url`` raises a
|
||||
``NoReverseMatch`` exception.
|
||||
Passing a non-view callable into resolve_url() raises a
|
||||
NoReverseMatch exception.
|
||||
"""
|
||||
with self.assertRaises(NoReverseMatch):
|
||||
resolve_url(lambda: 'asdf')
|
||||
|
||||
Reference in New Issue
Block a user