From 321e94fa41b121f65c02119c02098df327bbd569 Mon Sep 17 00:00:00 2001 From: za Date: Thu, 27 Oct 2016 14:53:39 +0700 Subject: Refs #27392 -- Removed "Tests that", "Ensures that", etc. from test docstrings. --- tests/utils_tests/test_autoreload.py | 9 ++++----- tests/utils_tests/test_datetime_safe.py | 2 +- tests/utils_tests/test_decorators.py | 8 +++----- tests/utils_tests/test_encoding.py | 4 ++-- tests/utils_tests/test_feedgenerator.py | 21 ++++++++++----------- tests/utils_tests/test_functional.py | 13 ++++--------- tests/utils_tests/test_html.py | 8 ++++---- tests/utils_tests/test_text.py | 9 +++------ 8 files changed, 31 insertions(+), 43 deletions(-) (limited to 'tests/utils_tests') diff --git a/tests/utils_tests/test_autoreload.py b/tests/utils_tests/test_autoreload.py index 6b60f00ede..b81ba351f0 100644 --- a/tests/utils_tests/test_autoreload.py +++ b/tests/utils_tests/test_autoreload.py @@ -42,7 +42,7 @@ class TestFilenameGenerator(SimpleTestCase): def test_django_locales(self): """ - Test that gen_filenames() yields the built-in Django locale files. + gen_filenames() yields the built-in Django locale files. """ django_dir = os.path.join(os.path.dirname(conf.__file__), 'locale') django_mo = os.path.join(django_dir, 'nl', 'LC_MESSAGES', 'django.mo') @@ -51,7 +51,7 @@ class TestFilenameGenerator(SimpleTestCase): @override_settings(LOCALE_PATHS=[LOCALE_PATH]) def test_locale_paths_setting(self): """ - Test that gen_filenames also yields from LOCALE_PATHS locales. + gen_filenames also yields from LOCALE_PATHS locales. """ locale_paths_mo = os.path.join(LOCALE_PATH, 'nl', 'LC_MESSAGES', 'django.mo') self.assertFileFound(locale_paths_mo) @@ -59,8 +59,7 @@ class TestFilenameGenerator(SimpleTestCase): @override_settings(INSTALLED_APPS=[]) def test_project_root_locale(self): """ - Test that gen_filenames also yields from the current directory (project - root). + gen_filenames() also yields from the current directory (project root). """ old_cwd = os.getcwd() os.chdir(os.path.dirname(__file__)) @@ -74,7 +73,7 @@ class TestFilenameGenerator(SimpleTestCase): @override_settings(INSTALLED_APPS=['django.contrib.admin']) def test_app_locales(self): """ - Test that gen_filenames also yields from locale dirs in installed apps. + gen_filenames() also yields from locale dirs in installed apps. """ admin_dir = os.path.join(os.path.dirname(admin.__file__), 'locale') admin_mo = os.path.join(admin_dir, 'nl', 'LC_MESSAGES', 'django.mo') diff --git a/tests/utils_tests/test_datetime_safe.py b/tests/utils_tests/test_datetime_safe.py index d86a60400b..5fa08bc4f4 100644 --- a/tests/utils_tests/test_datetime_safe.py +++ b/tests/utils_tests/test_datetime_safe.py @@ -56,6 +56,6 @@ class DatetimeTests(unittest.TestCase): """ Regression for #12524 - Check that pre-1000AD dates are padded with zeros if necessary + Pre-1000AD dates are padded with zeros if necessary """ self.assertEqual(date(1, 1, 1).strftime("%Y/%m/%d was a %A"), '0001/01/01 was a Monday') diff --git a/tests/utils_tests/test_decorators.py b/tests/utils_tests/test_decorators.py index 6135eb1994..06c6dc1cd2 100644 --- a/tests/utils_tests/test_decorators.py +++ b/tests/utils_tests/test_decorators.py @@ -65,9 +65,8 @@ class DecoratorFromMiddlewareTests(SimpleTestCase): def test_full_dec_normal(self): """ - Test that all methods of middleware are called for normal HttpResponses + All methods of middleware are called for normal HttpResponses """ - @full_dec def normal_view(request): template = engines['django'].from_string("Hello world") @@ -83,10 +82,9 @@ class DecoratorFromMiddlewareTests(SimpleTestCase): def test_full_dec_templateresponse(self): """ - Test that all methods of middleware are called for TemplateResponses in + All methods of middleware are called for TemplateResponses in the right sequence. """ - @full_dec def template_response_view(request): template = engines['django'].from_string("Hello world") @@ -105,7 +103,7 @@ class DecoratorFromMiddlewareTests(SimpleTestCase): self.assertFalse(getattr(request, 'process_response_reached', False)) response.render() self.assertTrue(getattr(request, 'process_response_reached', False)) - # Check that process_response saw the rendered content + # process_response saw the rendered content self.assertEqual(request.process_response_content, b"Hello world") diff --git a/tests/utils_tests/test_encoding.py b/tests/utils_tests/test_encoding.py index 5ddb18d069..688b46194d 100644 --- a/tests/utils_tests/test_encoding.py +++ b/tests/utils_tests/test_encoding.py @@ -16,7 +16,7 @@ from django.utils.http import urlquote_plus class TestEncodingUtils(unittest.TestCase): def test_force_text_exception(self): """ - Check that broken __unicode__/__str__ actually raises an error. + Broken __unicode__/__str__ actually raises an error. """ class MyString(object): def __str__(self): @@ -36,7 +36,7 @@ class TestEncodingUtils(unittest.TestCase): def test_force_bytes_exception(self): """ - Test that force_bytes knows how to convert to bytes an exception + force_bytes knows how to convert to bytes an exception containing non-ASCII characters in its args. """ error_msg = "This is an exception, voilà" diff --git a/tests/utils_tests/test_feedgenerator.py b/tests/utils_tests/test_feedgenerator.py index b72f250c02..9b249295c3 100644 --- a/tests/utils_tests/test_feedgenerator.py +++ b/tests/utils_tests/test_feedgenerator.py @@ -15,7 +15,7 @@ class FeedgeneratorTest(unittest.TestCase): def test_get_tag_uri(self): """ - Test get_tag_uri() correctly generates TagURIs. + get_tag_uri() correctly generates TagURIs. """ self.assertEqual( feedgenerator.get_tag_uri('http://example.org/foo/bar#headline', datetime.date(2004, 10, 25)), @@ -23,8 +23,7 @@ class FeedgeneratorTest(unittest.TestCase): def test_get_tag_uri_with_port(self): """ - Test that get_tag_uri() correctly generates TagURIs from URLs with port - numbers. + get_tag_uri() correctly generates TagURIs from URLs with port numbers. """ self.assertEqual( feedgenerator.get_tag_uri( @@ -35,7 +34,7 @@ class FeedgeneratorTest(unittest.TestCase): def test_rfc2822_date(self): """ - Test rfc2822_date() correctly formats datetime objects. + rfc2822_date() correctly formats datetime objects. """ self.assertEqual( feedgenerator.rfc2822_date(datetime.datetime(2008, 11, 14, 13, 37, 0)), @@ -44,7 +43,7 @@ class FeedgeneratorTest(unittest.TestCase): def test_rfc2822_date_with_timezone(self): """ - Test rfc2822_date() correctly formats datetime objects with tzinfo. + rfc2822_date() correctly formats datetime objects with tzinfo. """ self.assertEqual( feedgenerator.rfc2822_date(datetime.datetime(2008, 11, 14, 13, 37, 0, tzinfo=get_fixed_timezone(60))), @@ -53,7 +52,7 @@ class FeedgeneratorTest(unittest.TestCase): def test_rfc2822_date_without_time(self): """ - Test rfc2822_date() correctly formats date objects. + rfc2822_date() correctly formats date objects. """ self.assertEqual( feedgenerator.rfc2822_date(datetime.date(2008, 11, 14)), @@ -62,7 +61,7 @@ class FeedgeneratorTest(unittest.TestCase): def test_rfc3339_date(self): """ - Test rfc3339_date() correctly formats datetime objects. + rfc3339_date() correctly formats datetime objects. """ self.assertEqual( feedgenerator.rfc3339_date(datetime.datetime(2008, 11, 14, 13, 37, 0)), @@ -71,7 +70,7 @@ class FeedgeneratorTest(unittest.TestCase): def test_rfc3339_date_with_timezone(self): """ - Test rfc3339_date() correctly formats datetime objects with tzinfo. + rfc3339_date() correctly formats datetime objects with tzinfo. """ self.assertEqual( feedgenerator.rfc3339_date(datetime.datetime(2008, 11, 14, 13, 37, 0, tzinfo=get_fixed_timezone(120))), @@ -80,7 +79,7 @@ class FeedgeneratorTest(unittest.TestCase): def test_rfc3339_date_without_time(self): """ - Test rfc3339_date() correctly formats date objects. + rfc3339_date() correctly formats date objects. """ self.assertEqual( feedgenerator.rfc3339_date(datetime.date(2008, 11, 14)), @@ -89,7 +88,7 @@ class FeedgeneratorTest(unittest.TestCase): def test_atom1_mime_type(self): """ - Test to make sure Atom MIME type has UTF8 Charset parameter set + Atom MIME type has UTF8 Charset parameter set """ atom_feed = feedgenerator.Atom1Feed("title", "link", "description") self.assertEqual( @@ -98,7 +97,7 @@ class FeedgeneratorTest(unittest.TestCase): def test_rss_mime_type(self): """ - Test to make sure RSS MIME type has UTF8 Charset parameter set + RSS MIME type has UTF8 Charset parameter set """ rss_feed = feedgenerator.Rss201rev2Feed("title", "link", "description") self.assertEqual( diff --git a/tests/utils_tests/test_functional.py b/tests/utils_tests/test_functional.py index f62784f1b0..1413ac23b3 100644 --- a/tests/utils_tests/test_functional.py +++ b/tests/utils_tests/test_functional.py @@ -14,8 +14,7 @@ class FunctionalTestCase(unittest.TestCase): self.assertEqual(a, b) def test_lazy_base_class(self): - """Test that lazy also finds base class methods in the proxy object""" - + """lazy also finds base class methods in the proxy object""" class Base(object): def base_method(self): pass @@ -27,8 +26,7 @@ class FunctionalTestCase(unittest.TestCase): self.assertIn('base_method', dir(t)) def test_lazy_base_class_override(self): - """Test that lazy finds the correct (overridden) method implementation""" - + """lazy finds the correct (overridden) method implementation""" class Base(object): def method(self): return 'Base' @@ -81,10 +79,8 @@ class FunctionalTestCase(unittest.TestCase): def test_cached_property(self): """ - Test that cached_property caches its value, - and that it behaves like a property + cached_property caches its value and that it behaves like a property """ - class A(object): @cached_property @@ -121,9 +117,8 @@ class FunctionalTestCase(unittest.TestCase): def test_lazy_equality(self): """ - Tests that == and != work correctly for Promises. + == and != work correctly for Promises. """ - lazy_a = lazy(lambda: 4, int) lazy_b = lazy(lambda: 4, int) lazy_c = lazy(lambda: 5, int) diff --git a/tests/utils_tests/test_html.py b/tests/utils_tests/test_html.py index 20de85148e..39d590032f 100644 --- a/tests/utils_tests/test_html.py +++ b/tests/utils_tests/test_html.py @@ -15,8 +15,8 @@ class TestUtilsHtml(SimpleTestCase): def check_output(self, function, value, output=None): """ - Check that function(value) equals output. If output is None, - check that function(value) equals value. + function(value) equals output. If output is None, function(value) + equals value. """ if output is None: output = value @@ -149,10 +149,10 @@ class TestUtilsHtml(SimpleTestCase): def test_smart_urlquote(self): quote = html.smart_urlquote - # Ensure that IDNs are properly quoted + # IDNs are properly quoted self.assertEqual(quote('http://öäü.com/'), 'http://xn--4ca9at.com/') self.assertEqual(quote('http://öäü.com/öäü/'), 'http://xn--4ca9at.com/%C3%B6%C3%A4%C3%BC/') - # Ensure that everything unsafe is quoted, !*'();:@&=+$,/?#[]~ is considered safe as per RFC + # Everything unsafe is quoted, !*'();:@&=+$,/?#[]~ is considered safe as per RFC self.assertEqual(quote('http://example.com/path/öäü/'), 'http://example.com/path/%C3%B6%C3%A4%C3%BC/') self.assertEqual(quote('http://example.com/%C3%B6/ä/'), 'http://example.com/%C3%B6/%C3%A4/') self.assertEqual(quote('http://example.com/?x=1&y=2+3&z='), 'http://example.com/?x=1&y=2+3&z=') diff --git a/tests/utils_tests/test_text.py b/tests/utils_tests/test_text.py index 1ce993bdb2..3dfc33a120 100644 --- a/tests/utils_tests/test_text.py +++ b/tests/utils_tests/test_text.py @@ -56,14 +56,11 @@ class TestUtilsText(SimpleTestCase): self.assertEqual(list(text.smart_split(test)), expected) def test_truncate_chars(self): - truncator = text.Truncator( - 'The quick brown fox jumped over the lazy dog.' - ) + truncator = text.Truncator('The quick brown fox jumped over the lazy dog.') self.assertEqual('The quick brown fox jumped over the lazy dog.', truncator.chars(100)), self.assertEqual('The quick brown fox ...', truncator.chars(23)), self.assertEqual('The quick brown fo.....', truncator.chars(23, '.....')), - # Ensure that we normalize our unicode data first nfc = text.Truncator('o\xfco\xfco\xfco\xfc') nfd = text.Truncator('ou\u0308ou\u0308ou\u0308ou\u0308') self.assertEqual('oüoüoüoü', nfc.chars(8)) @@ -88,7 +85,7 @@ class TestUtilsText(SimpleTestCase): # Make a best effort to shorten to the desired length, but requesting # a length shorter than the ellipsis shouldn't break self.assertEqual('...', text.Truncator('asdf').chars(1)) - # Ensure that lazy strings are handled correctly + # lazy strings are handled correctly self.assertEqual(text.Truncator(lazystr('The quick brown fox')).chars(12), 'The quick...') def test_truncate_words(self): @@ -96,7 +93,7 @@ class TestUtilsText(SimpleTestCase): self.assertEqual('The quick brown fox jumped over the lazy dog.', truncator.words(10)) self.assertEqual('The quick brown fox...', truncator.words(4)) self.assertEqual('The quick brown fox[snip]', truncator.words(4, '[snip]')) - # Ensure that lazy strings are handled correctly + # lazy strings are handled correctly truncator = text.Truncator(lazystr('The quick brown fox jumped over the lazy dog.')) self.assertEqual('The quick brown fox...', truncator.words(4)) -- cgit v1.3