From f7969b0920c403118656f6bfec58d6454d79ef1a Mon Sep 17 00:00:00 2001 From: Berker Peksag Date: Tue, 28 Oct 2014 12:02:56 +0200 Subject: [PATCH] Fixed #23620 -- Used more specific assertions in the Django test suite. --- .../auth/tests/test_context_processors.py | 8 +- django/contrib/auth/tests/test_decorators.py | 2 +- django/contrib/auth/tests/test_handlers.py | 4 +- django/contrib/auth/tests/test_signals.py | 2 +- django/contrib/auth/tests/test_views.py | 30 ++-- django/contrib/gis/geos/tests/test_geos.py | 16 +- .../gis/geos/tests/test_mutable_list.py | 39 +++-- django/contrib/gis/tests/relatedapp/tests.py | 4 +- django/contrib/gis/tests/test_geoforms.py | 2 +- django/contrib/gis/tests/test_measure.py | 12 +- django/contrib/messages/tests/base.py | 10 +- django/contrib/messages/tests/test_cookie.py | 4 +- django/contrib/sessions/tests.py | 2 +- tests/admin_changelist/tests.py | 4 +- tests/admin_docs/tests.py | 16 +- tests/admin_scripts/tests.py | 8 +- tests/admin_views/tests.py | 10 +- tests/admin_widgets/tests.py | 8 +- tests/aggregation_regress/tests.py | 16 +- tests/backends/tests.py | 6 +- tests/basic/tests.py | 20 ++- tests/bulk_create/tests.py | 4 +- tests/cache/tests.py | 4 +- tests/csrf_tests/tests.py | 6 +- tests/datatypes/tests.py | 2 +- tests/empty/tests.py | 4 +- tests/expressions/tests.py | 2 +- tests/field_defaults/tests.py | 2 +- tests/file_storage/tests.py | 8 +- tests/file_uploads/tests.py | 6 +- tests/fixtures_model_package/tests.py | 5 +- tests/foreign_object/tests.py | 2 +- tests/forms_tests/tests/test_extra.py | 4 +- tests/forms_tests/tests/test_forms.py | 7 +- tests/forms_tests/tests/test_widgets.py | 12 +- tests/forms_tests/tests/tests.py | 2 +- tests/generic_relations_regress/tests.py | 4 +- tests/generic_views/test_base.py | 2 +- tests/generic_views/test_dates.py | 2 +- tests/generic_views/test_detail.py | 4 +- tests/generic_views/test_edit.py | 12 +- tests/httpwrappers/tests.py | 16 +- tests/i18n/test_extraction.py | 92 ++++++------ tests/i18n/tests.py | 2 +- tests/introspection/tests.py | 6 +- tests/logging_tests/tests.py | 8 +- tests/m2m_regress/tests.py | 8 +- tests/mail/tests.py | 30 ++-- tests/many_to_one/tests.py | 20 +-- tests/middleware/test_security.py | 2 +- tests/middleware/tests.py | 16 +- tests/migrations/test_autodetector.py | 4 +- tests/migrations/test_commands.py | 24 +-- tests/model_fields/tests.py | 4 +- tests/model_forms/tests.py | 18 +-- tests/model_formsets/tests.py | 4 +- tests/model_formsets_regress/tests.py | 6 +- tests/model_meta/test.py | 6 +- tests/multiple_database/tests.py | 2 +- tests/null_fk/tests.py | 2 +- tests/null_fk_ordering/tests.py | 4 +- tests/one_to_one/tests.py | 12 +- tests/pagination/tests.py | 4 +- tests/prefetch_related/tests.py | 8 +- tests/proxy_models/tests.py | 8 +- tests/queries/tests.py | 139 +++++++++--------- tests/raw_query/tests.py | 4 +- tests/requests/tests.py | 2 +- tests/select_related_regress/tests.py | 4 +- tests/settings_tests/tests.py | 2 +- tests/template_tests/tests.py | 10 +- tests/test_client_regress/tests.py | 4 +- tests/test_runner/tests.py | 2 +- tests/test_utils/tests.py | 18 +-- tests/unmanaged_models/tests.py | 4 +- tests/update_only_fields/tests.py | 4 +- tests/urlpatterns_reverse/tests.py | 4 +- tests/utils_tests/test_datastructures.py | 2 +- tests/utils_tests/test_functional.py | 2 +- tests/utils_tests/test_http.py | 4 +- tests/utils_tests/test_lazyobject.py | 12 +- tests/view_tests/tests/test_debug.py | 4 +- tests/wsgi/tests.py | 4 +- 83 files changed, 419 insertions(+), 429 deletions(-) diff --git a/django/contrib/auth/tests/test_context_processors.py b/django/contrib/auth/tests/test_context_processors.py index 9de08bf96a..e0e75a947e 100644 --- a/django/contrib/auth/tests/test_context_processors.py +++ b/django/contrib/auth/tests/test_context_processors.py @@ -45,10 +45,10 @@ class PermWrapperTests(TestCase): """ perms = PermWrapper(MockUser()) # Works for modules and full permissions. - self.assertTrue('mockapp' in perms) - self.assertFalse('nonexisting' in perms) - self.assertTrue('mockapp.someperm' in perms) - self.assertFalse('mockapp.nonexisting' in perms) + self.assertIn('mockapp', perms) + self.assertNotIn('nonexisting', perms) + self.assertIn('mockapp.someperm', perms) + self.assertNotIn('mockapp.nonexisting', perms) def test_permlookupdict_in(self): """ diff --git a/django/contrib/auth/tests/test_decorators.py b/django/contrib/auth/tests/test_decorators.py index 61cdee4cbb..c5602be219 100644 --- a/django/contrib/auth/tests/test_decorators.py +++ b/django/contrib/auth/tests/test_decorators.py @@ -42,7 +42,7 @@ class LoginRequiredTestCase(AuthViewsTestCase): login_url = settings.LOGIN_URL response = self.client.get(view_url) self.assertEqual(response.status_code, 302) - self.assertTrue(login_url in response.url) + self.assertIn(login_url, response.url) self.login() response = self.client.get(view_url) self.assertEqual(response.status_code, 200) diff --git a/django/contrib/auth/tests/test_handlers.py b/django/contrib/auth/tests/test_handlers.py index f041bd54e1..f4fa3030de 100644 --- a/django/contrib/auth/tests/test_handlers.py +++ b/django/contrib/auth/tests/test_handlers.py @@ -29,7 +29,7 @@ class ModWsgiHandlerTestCase(TransactionTestCase): User.objects.create_user('test', 'test@example.com', 'test') # User not in database - self.assertTrue(check_password({}, 'unknown', '') is None) + self.assertIsNone(check_password({}, 'unknown', '')) # Valid user with correct password self.assertTrue(check_password({}, 'test', 'test')) @@ -53,7 +53,7 @@ class ModWsgiHandlerTestCase(TransactionTestCase): CustomUser._default_manager.create_user('test@example.com', '1990-01-01', 'test') # User not in database - self.assertTrue(check_password({}, 'unknown', '') is None) + self.assertIsNone(check_password({}, 'unknown', '')) # Valid user with correct password' self.assertTrue(check_password({}, 'test@example.com', 'test')) diff --git a/django/contrib/auth/tests/test_signals.py b/django/contrib/auth/tests/test_signals.py index 61513b4177..04c5b89e0b 100644 --- a/django/contrib/auth/tests/test_signals.py +++ b/django/contrib/auth/tests/test_signals.py @@ -44,7 +44,7 @@ class SignalTestCase(TestCase): self.assertEqual(len(self.login_failed), 1) self.assertEqual(self.login_failed[0]['username'], 'testclient') # verify the password is cleansed - self.assertTrue('***' in self.login_failed[0]['password']) + self.assertIn('***', self.login_failed[0]['password']) # Like this: self.client.login(username='testclient', password='password') diff --git a/django/contrib/auth/tests/test_views.py b/django/contrib/auth/tests/test_views.py index 710324b2a1..251af54ec8 100644 --- a/django/contrib/auth/tests/test_views.py +++ b/django/contrib/auth/tests/test_views.py @@ -55,13 +55,13 @@ class AuthViewsTestCase(TestCase): 'username': username, 'password': password, }) - self.assertTrue(SESSION_KEY in self.client.session) + self.assertIn(SESSION_KEY, self.client.session) return response def logout(self): response = self.client.get('/admin/logout/') self.assertEqual(response.status_code, 200) - self.assertTrue(SESSION_KEY not in self.client.session) + self.assertNotIn(SESSION_KEY, self.client.session) def assertFormError(self, response, error): """Assert that error is found in response.context['form'] errors""" @@ -129,7 +129,7 @@ class PasswordResetTest(AuthViewsTestCase): response = self.client.post('/password_reset/', {'email': 'staffmember@example.com'}) self.assertEqual(response.status_code, 302) self.assertEqual(len(mail.outbox), 1) - self.assertTrue("http://" in mail.outbox[0].body) + self.assertIn("http://", mail.outbox[0].body) self.assertEqual(settings.DEFAULT_FROM_EMAIL, mail.outbox[0].from_email) # optional multipart text/html email has been added. Make sure original, # default functionality is 100% the same @@ -148,8 +148,8 @@ class PasswordResetTest(AuthViewsTestCase): self.assertTrue(message.is_multipart()) self.assertEqual(message.get_payload(0).get_content_type(), 'text/plain') self.assertEqual(message.get_payload(1).get_content_type(), 'text/html') - self.assertTrue('' not in message.get_payload(0).get_payload()) - self.assertTrue('' in message.get_payload(1).get_payload()) + self.assertNotIn('', message.get_payload(0).get_payload()) + self.assertIn('', message.get_payload(1).get_payload()) def test_email_found_custom_from(self): "Email is sent if a valid email address is provided for password reset when a custom from_email is provided." @@ -169,7 +169,7 @@ class PasswordResetTest(AuthViewsTestCase): ) self.assertEqual(response.status_code, 302) self.assertEqual(len(mail.outbox), 1) - self.assertTrue("http://adminsite.com" in mail.outbox[0].body) + self.assertIn("http://adminsite.com", mail.outbox[0].body) self.assertEqual(settings.DEFAULT_FROM_EMAIL, mail.outbox[0].from_email) # Skip any 500 handler action (like sending more mail...) @@ -215,7 +215,7 @@ class PasswordResetTest(AuthViewsTestCase): def _read_signup_email(self, email): urlmatch = re.search(r"https?://[^/]*(/.*reset/\S*)", email.body) - self.assertTrue(urlmatch is not None, "No URL found in sent email") + self.assertIsNotNone(urlmatch, "No URL found in sent email") return urlmatch.group(), urlmatch.groups()[0] def test_confirm_valid(self): @@ -346,7 +346,7 @@ class CustomUserPasswordResetTest(AuthViewsTestCase): def _read_signup_email(self, email): urlmatch = re.search(r"https?://[^/]*(/.*reset/\S*)", email.body) - self.assertTrue(urlmatch is not None, "No URL found in sent email") + self.assertIsNotNone(urlmatch, "No URL found in sent email") return urlmatch.group(), urlmatch.groups()[0] def test_confirm_valid_custom_user(self): @@ -502,7 +502,7 @@ class LoginTest(AuthViewsTestCase): 'password': password, }) self.assertEqual(response.status_code, 302) - self.assertFalse(bad_url in response.url, + self.assertNotIn(bad_url, response.url, "%s should be blocked" % bad_url) # These URLs *should* still pass the security check @@ -524,8 +524,7 @@ class LoginTest(AuthViewsTestCase): 'password': password, }) self.assertEqual(response.status_code, 302) - self.assertTrue(good_url in response.url, - "%s should be allowed" % good_url) + self.assertIn(good_url, response.url, "%s should be allowed" % good_url) def test_login_form_contains_request(self): # 15198 @@ -683,7 +682,7 @@ class LoginRedirectUrlTest(AuthViewsTestCase): class LogoutTest(AuthViewsTestCase): def confirm_logged_out(self): - self.assertTrue(SESSION_KEY not in self.client.session) + self.assertNotIn(SESSION_KEY, self.client.session) def test_logout_default(self): "Logout without next_page option renders the default template" @@ -696,7 +695,7 @@ class LogoutTest(AuthViewsTestCase): # Bug 14377 self.login() response = self.client.get('/logout/') - self.assertTrue('site' in response.context) + self.assertIn('site', response.context) def test_logout_with_overridden_redirect_url(self): # Bug 11223 @@ -762,7 +761,7 @@ class LogoutTest(AuthViewsTestCase): self.login() response = self.client.get(nasty_url) self.assertEqual(response.status_code, 302) - self.assertFalse(bad_url in response.url, + self.assertNotIn(bad_url, response.url, "%s should be blocked" % bad_url) self.confirm_logged_out() @@ -783,8 +782,7 @@ class LogoutTest(AuthViewsTestCase): self.login() response = self.client.get(safe_url) self.assertEqual(response.status_code, 302) - self.assertTrue(good_url in response.url, - "%s should be allowed" % good_url) + self.assertIn(good_url, response.url, "%s should be allowed" % good_url) self.confirm_logged_out() def test_logout_preserve_language(self): diff --git a/django/contrib/gis/geos/tests/test_geos.py b/django/contrib/gis/geos/tests/test_geos.py index 3076e41cca..bc703664d5 100644 --- a/django/contrib/gis/geos/tests/test_geos.py +++ b/django/contrib/gis/geos/tests/test_geos.py @@ -436,17 +436,13 @@ class GEOSTest(unittest.TestCase, TestDataMixin): def test_polygon_comparison(self): p1 = Polygon(((0, 0), (0, 1), (1, 1), (1, 0), (0, 0))) p2 = Polygon(((0, 0), (0, 1), (1, 0), (0, 0))) - self.assertTrue(p1 > p2) - self.assertFalse(p1 < p2) - self.assertFalse(p2 > p1) - self.assertTrue(p2 < p1) + self.assertGreater(p1, p2) + self.assertLess(p2, p1) p3 = Polygon(((0, 0), (0, 1), (1, 1), (2, 0), (0, 0))) p4 = Polygon(((0, 0), (0, 1), (2, 2), (1, 0), (0, 0))) - self.assertFalse(p4 < p3) - self.assertTrue(p3 < p4) - self.assertTrue(p4 > p3) - self.assertFalse(p3 > p4) + self.assertGreater(p4, p3) + self.assertLess(p3, p4) def test_multipolygons(self): "Testing MultiPolygon objects." @@ -911,7 +907,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin): g1 = g.transform(4326, clone=True) self.assertEqual(g1.tuple, g.tuple) self.assertEqual(g1.srid, 4326) - self.assertTrue(g1 is not g, "Clone didn't happen") + self.assertIsNot(g1, g, "Clone didn't happen") old_has_gdal = gdal.HAS_GDAL try: @@ -927,7 +923,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin): g1 = g.transform(4326, clone=True) self.assertEqual(g1.tuple, g.tuple) self.assertEqual(g1.srid, 4326) - self.assertTrue(g1 is not g, "Clone didn't happen") + self.assertIsNot(g1, g, "Clone didn't happen") finally: gdal.HAS_GDAL = old_has_gdal diff --git a/django/contrib/gis/geos/tests/test_mutable_list.py b/django/contrib/gis/geos/tests/test_mutable_list.py index 9cdd80bc17..cde78045f1 100644 --- a/django/contrib/gis/geos/tests/test_mutable_list.py +++ b/django/contrib/gis/geos/tests/test_mutable_list.py @@ -391,35 +391,34 @@ class ListMixinTest(unittest.TestCase): pl, ul = self.lists_of_len() self.assertEqual(pl, ul, 'cmp for equal') - self.assertFalse(ul == pl + [2], 'cmp for not equal') - self.assertTrue(pl >= ul, 'cmp for gte self') - self.assertTrue(pl <= ul, 'cmp for lte self') - self.assertTrue(ul >= pl, 'cmp for self gte') - self.assertTrue(ul <= pl, 'cmp for self lte') + self.assertNotEqual(ul, pl + [2], 'cmp for not equal') + self.assertGreaterEqual(pl, ul, 'cmp for gte self') + self.assertLessEqual(pl, ul, 'cmp for lte self') + self.assertGreaterEqual(ul, pl, 'cmp for self gte') + self.assertLessEqual(ul, pl, 'cmp for self lte') - self.assertTrue(pl + [5] > ul, 'cmp') - self.assertTrue(pl + [5] >= ul, 'cmp') - self.assertTrue(pl < ul + [2], 'cmp') - self.assertTrue(pl <= ul + [2], 'cmp') - self.assertTrue(ul + [5] > pl, 'cmp') - self.assertTrue(ul + [5] >= pl, 'cmp') - self.assertTrue(ul < pl + [2], 'cmp') - self.assertTrue(ul <= pl + [2], 'cmp') + self.assertGreater(pl + [5], ul, 'cmp') + self.assertGreaterEqual(pl + [5], ul, 'cmp') + self.assertLess(pl, ul + [2], 'cmp') + self.assertLessEqual(pl, ul + [2], 'cmp') + self.assertGreater(ul + [5], pl, 'cmp') + self.assertGreaterEqual(ul + [5], pl, 'cmp') + self.assertLess(ul, pl + [2], 'cmp') + self.assertLessEqual(ul, pl + [2], 'cmp') # Also works with a custom IndexError ul_longer = ul + [2] ul_longer._IndexError = TypeError ul._IndexError = TypeError - self.assertFalse(ul_longer == pl) - self.assertFalse(ul == ul_longer) - self.assertTrue(ul_longer > ul) + self.assertNotEqual(ul_longer, pl) + self.assertGreater(ul_longer, ul) pl[1] = 20 - self.assertTrue(pl > ul, 'cmp for gt self') - self.assertTrue(ul < pl, 'cmp for self lt') + self.assertGreater(pl, ul, 'cmp for gt self') + self.assertLess(ul, pl, 'cmp for self lt') pl[1] = -20 - self.assertTrue(pl < ul, 'cmp for lt self') - self.assertTrue(pl < ul, 'cmp for lt self') + self.assertLess(pl, ul, 'cmp for lt self') + self.assertGreater(ul, pl, 'cmp for gt self') class ListMixinTestSingle(ListMixinTest): diff --git a/django/contrib/gis/tests/relatedapp/tests.py b/django/contrib/gis/tests/relatedapp/tests.py index fa1b2de8c8..a19e317a14 100644 --- a/django/contrib/gis/tests/relatedapp/tests.py +++ b/django/contrib/gis/tests/relatedapp/tests.py @@ -228,8 +228,8 @@ class RelatedGeoModelTest(TestCase): combined = qs1 | qs2 names = [c.name for c in combined] self.assertEqual(2, len(names)) - self.assertTrue('Aurora' in names) - self.assertTrue('Kecksburg' in names) + self.assertIn('Aurora', names) + self.assertIn('Kecksburg', names) def test11_geoquery_pickle(self): "Ensuring GeoQuery objects are unpickled correctly. See #10839." diff --git a/django/contrib/gis/tests/test_geoforms.py b/django/contrib/gis/tests/test_geoforms.py index 19147ec75d..fa72cd1fac 100644 --- a/django/contrib/gis/tests/test_geoforms.py +++ b/django/contrib/gis/tests/test_geoforms.py @@ -174,7 +174,7 @@ class SpecializedFieldTest(SimpleTestCase): self.assertFalse(PointForm().is_valid()) invalid = PointForm(data={'p': 'some invalid geom'}) self.assertFalse(invalid.is_valid()) - self.assertTrue('Invalid geometry value' in str(invalid.errors)) + self.assertIn('Invalid geometry value', str(invalid.errors)) for invalid in [geo for key, geo in self.geometries.items() if key != 'point']: self.assertFalse(PointForm(data={'p': invalid.wkt}).is_valid()) diff --git a/django/contrib/gis/tests/test_measure.py b/django/contrib/gis/tests/test_measure.py index 94284fb28a..f6b89ce1ca 100644 --- a/django/contrib/gis/tests/test_measure.py +++ b/django/contrib/gis/tests/test_measure.py @@ -122,9 +122,9 @@ class DistanceTest(unittest.TestCase): d2 = D(km=1) d3 = D(km=0) - self.assertTrue(d2 > d1) - self.assertTrue(d1 == d1) - self.assertTrue(d1 < d2) + self.assertGreater(d2, d1) + self.assertEqual(d1, d1) + self.assertLess(d1, d2) self.assertFalse(d3) def testUnitsStr(self): @@ -249,9 +249,9 @@ class AreaTest(unittest.TestCase): a2 = A(sq_km=1) a3 = A(sq_km=0) - self.assertTrue(a2 > a1) - self.assertTrue(a1 == a1) - self.assertTrue(a1 < a2) + self.assertGreater(a2, a1) + self.assertEqual(a1, a1) + self.assertLess(a1, a2) self.assertFalse(a3) def testUnitsStr(self): diff --git a/django/contrib/messages/tests/base.py b/django/contrib/messages/tests/base.py index e56ae971e8..9c8745784b 100644 --- a/django/contrib/messages/tests/base.py +++ b/django/contrib/messages/tests/base.py @@ -163,7 +163,7 @@ class BaseTests(object): add_url = reverse('add_message', args=(level,)) response = self.client.post(add_url, data, follow=True) self.assertRedirects(response, show_url) - self.assertTrue('messages' in response.context) + self.assertIn('messages', response.context) messages = [Message(self.levels[level], msg) for msg in data['messages']] self.assertEqual(list(response.context['messages']), messages) for msg in data['messages']: @@ -179,7 +179,7 @@ class BaseTests(object): add_url = reverse('add_template_response', args=(level,)) response = self.client.post(add_url, data, follow=True) self.assertRedirects(response, show_url) - self.assertTrue('messages' in response.context) + self.assertIn('messages', response.context) for msg in data['messages']: self.assertContains(response, msg) @@ -192,7 +192,7 @@ class BaseTests(object): show_url = reverse('show_template_response') response = self.client.get(show_url) - self.assertTrue('DEFAULT_MESSAGE_LEVELS' in response.context) + self.assertIn('DEFAULT_MESSAGE_LEVELS', response.context) self.assertEqual(response.context['DEFAULT_MESSAGE_LEVELS'], DEFAULT_LEVELS) @override_settings(MESSAGE_LEVEL=constants.DEBUG) @@ -211,7 +211,7 @@ class BaseTests(object): add_url = reverse('add_message', args=(level,)) self.client.post(add_url, data) response = self.client.get(show_url) - self.assertTrue('messages' in response.context) + self.assertIn('messages', response.context) self.assertEqual(list(response.context['messages']), messages) for msg in data['messages']: self.assertContains(response, msg) @@ -255,7 +255,7 @@ class BaseTests(object): add_url = reverse('add_message', args=(level,)) response = self.client.post(add_url, data, follow=True) self.assertRedirects(response, show_url) - self.assertFalse('messages' in response.context) + self.assertNotIn('messages', response.context) def stored_messages_count(self, storage, response): """ diff --git a/django/contrib/messages/tests/test_cookie.py b/django/contrib/messages/tests/test_cookie.py index 10082634f6..ba7b4dc08b 100644 --- a/django/contrib/messages/tests/test_cookie.py +++ b/django/contrib/messages/tests/test_cookie.py @@ -65,7 +65,7 @@ class CookieTest(BaseTests, TestCase): response = self.get_response() storage.add(constants.INFO, 'test') storage.update(response) - self.assertTrue('test' in response.cookies['messages'].value) + self.assertIn('test', response.cookies['messages'].value) self.assertEqual(response.cookies['messages']['domain'], '.example.com') self.assertEqual(response.cookies['messages']['expires'], '') self.assertEqual(response.cookies['messages']['secure'], True) @@ -114,7 +114,7 @@ class CookieTest(BaseTests, TestCase): self.assertEqual(cookie_storing, 4) self.assertEqual(len(unstored_messages), 1) - self.assertTrue(unstored_messages[0].message == '0' * msg_size) + self.assertEqual(unstored_messages[0].message, '0' * msg_size) def test_json_encoder_decoder(self): """ diff --git a/django/contrib/sessions/tests.py b/django/contrib/sessions/tests.py index b8bf512c35..fe74c3f255 100644 --- a/django/contrib/sessions/tests.py +++ b/django/contrib/sessions/tests.py @@ -286,7 +286,7 @@ class SessionTestsMixin(object): self.assertEqual({}, self.session.decode(bad_encode)) # check that the failed decode is logged self.assertEqual(len(calls), 1) - self.assertTrue('corrupted' in calls[0]) + self.assertIn('corrupted', calls[0]) def test_actual_expiry(self): # this doesn't work with JSONSerializer (serializing timedelta) diff --git a/tests/admin_changelist/tests.py b/tests/admin_changelist/tests.py index d89b0857ec..5ee5a512db 100644 --- a/tests/admin_changelist/tests.py +++ b/tests/admin_changelist/tests.py @@ -93,7 +93,7 @@ class ChangeListTests(TestCase): table_output = template.render(context) link = reverse('admin:admin_changelist_child_change', args=(new_child.id,)) row_html = 'name(None)' % link - self.assertFalse(table_output.find(row_html) == -1, + self.assertNotEqual(table_output.find(row_html), -1, 'Failed to find expected row element: %s' % table_output) def test_result_list_html(self): @@ -116,7 +116,7 @@ class ChangeListTests(TestCase): table_output = template.render(context) link = reverse('admin:admin_changelist_child_change', args=(new_child.id,)) row_html = 'nameParent object' % link - self.assertFalse(table_output.find(row_html) == -1, + self.assertNotEqual(table_output.find(row_html), -1, 'Failed to find expected row element: %s' % table_output) def test_result_list_editable_html(self): diff --git a/tests/admin_docs/tests.py b/tests/admin_docs/tests.py index c410eff020..6234834955 100644 --- a/tests/admin_docs/tests.py +++ b/tests/admin_docs/tests.py @@ -130,38 +130,38 @@ class XViewMiddlewareTest(AdminDocsTestCase): def test_xview_func(self): user = User.objects.get(username='super') response = self.client.head('/xview/func/') - self.assertFalse('X-View' in response) + self.assertNotIn('X-View', response) self.client.login(username='super', password='secret') response = self.client.head('/xview/func/') - self.assertTrue('X-View' in response) + self.assertIn('X-View', response) self.assertEqual(response['X-View'], 'admin_docs.views.xview') user.is_staff = False user.save() response = self.client.head('/xview/func/') - self.assertFalse('X-View' in response) + self.assertNotIn('X-View', response) user.is_staff = True user.is_active = False user.save() response = self.client.head('/xview/func/') - self.assertFalse('X-View' in response) + self.assertNotIn('X-View', response) def test_xview_class(self): user = User.objects.get(username='super') response = self.client.head('/xview/class/') - self.assertFalse('X-View' in response) + self.assertNotIn('X-View', response) self.client.login(username='super', password='secret') response = self.client.head('/xview/class/') - self.assertTrue('X-View' in response) + self.assertIn('X-View', response) self.assertEqual(response['X-View'], 'admin_docs.views.XViewClass') user.is_staff = False user.save() response = self.client.head('/xview/class/') - self.assertFalse('X-View' in response) + self.assertNotIn('X-View', response) user.is_staff = True user.is_active = False user.save() response = self.client.head('/xview/class/') - self.assertFalse('X-View' in response) + self.assertNotIn('X-View', response) @unittest.skipUnless(utils.docutils_is_available, "no docutils installed.") diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py index 5bc0fb3ee1..aaf4f17c75 100644 --- a/tests/admin_scripts/tests.py +++ b/tests/admin_scripts/tests.py @@ -190,12 +190,12 @@ class AdminScriptTestCase(unittest.TestCase): self.assertIsNotNone(re.search(msg, stream), "'%s' does not match actual output text '%s'" % (msg, stream)) else: - self.assertTrue(msg in stream, "'%s' does not match actual output text '%s'" % (msg, stream)) + self.assertIn(msg, stream, "'%s' does not match actual output text '%s'" % (msg, stream)) def assertNotInOutput(self, stream, msg): "Utility assertion: assert that the given message doesn't exist in the output" stream = force_text(stream) - self.assertFalse(msg in stream, "'%s' matches actual output text '%s'" % (msg, stream)) + self.assertNotIn(msg, stream, "'%s' matches actual output text '%s'" % (msg, stream)) ########################################################################## # DJANGO ADMIN TESTS @@ -904,7 +904,7 @@ class ManageAlternateSettings(AdminScriptTestCase): out, err = self.run_manage(args) expected = ('create table %s' % connection.ops.quote_name('admin_scripts_article')) - self.assertTrue(expected.lower() in out.lower()) + self.assertIn(expected.lower(), out.lower()) self.assertNoOutput(err) def test_builtin_with_environment(self): @@ -913,7 +913,7 @@ class ManageAlternateSettings(AdminScriptTestCase): out, err = self.run_manage(args, 'alternate_settings') expected = ('create table %s' % connection.ops.quote_name('admin_scripts_article')) - self.assertTrue(expected.lower() in out.lower()) + self.assertIn(expected.lower(), out.lower()) self.assertNoOutput(err) def test_builtin_with_bad_settings(self): diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py index 051fc0ae8d..562d7573e6 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -90,7 +90,7 @@ class AdminViewBasicTestCase(TestCase): content. """ self.assertEqual(response.status_code, 200) - self.assertTrue(response.content.index(force_bytes(text1)) < response.content.index(force_bytes(text2)), + self.assertLess(response.content.index(force_bytes(text1)), response.content.index(force_bytes(text2)), failing_msg) @@ -866,7 +866,7 @@ class AdminViewFormUrlTest(TestCase): Tests whether change_view has form_url in response.context """ response = self.client.get('/test_admin/%s/admin_views/section/1/' % self.urlbit) - self.assertTrue('form_url' in response.context, msg='form_url not present in response.context') + self.assertIn('form_url', response.context, msg='form_url not present in response.context') self.assertEqual(response.context['form_url'], 'pony') def test_initial_data_can_be_overridden(self): @@ -4123,7 +4123,7 @@ class UserAdminTest(TestCase): }) self.assertEqual(response.status_code, 200) adminform = response.context['adminform'] - self.assertTrue('password' not in adminform.form.errors) + self.assertNotIn('password', adminform.form.errors) self.assertEqual(adminform.form.errors['password2'], ["The two password fields didn't match."]) @@ -5040,7 +5040,7 @@ class AdminViewOnSiteTests(TestCase): # just verifying the parent form failed validation, as expected -- # this isn't the regression test - self.assertTrue('some_required_info' in response.context['adminform'].form.errors) + self.assertIn('some_required_info', response.context['adminform'].form.errors) # actual regression test for error_set in response.context['inline_admin_formset'].formset.errors: @@ -5070,7 +5070,7 @@ class AdminViewOnSiteTests(TestCase): # just verifying the parent form failed validation, as expected -- # this isn't the regression test - self.assertTrue('some_required_info' in response.context['adminform'].form.errors) + self.assertIn('some_required_info', response.context['adminform'].form.errors) # actual regression test for error_set in response.context['inline_admin_formset'].formset.errors: diff --git a/tests/admin_widgets/tests.py b/tests/admin_widgets/tests.py index fdca577809..1617f92326 100644 --- a/tests/admin_widgets/tests.py +++ b/tests/admin_widgets/tests.py @@ -1046,7 +1046,7 @@ class AdminRawIdWidgetSeleniumFirefoxTests(AdminSeleniumWebDriverTestCase): self.selenium.switch_to.window('id_main_band') self.wait_page_loaded() link = self.selenium.find_element_by_link_text('Bogey Blues') - self.assertTrue('/band/42/' in link.get_attribute('href')) + self.assertIn('/band/42/', link.get_attribute('href')) link.click() # The field now contains the selected band's id @@ -1058,7 +1058,7 @@ class AdminRawIdWidgetSeleniumFirefoxTests(AdminSeleniumWebDriverTestCase): self.selenium.switch_to.window('id_main_band') self.wait_page_loaded() link = self.selenium.find_element_by_link_text('Green Potatoes') - self.assertTrue('/band/98/' in link.get_attribute('href')) + self.assertIn('/band/98/', link.get_attribute('href')) link.click() # The field now contains the other selected band's id @@ -1081,7 +1081,7 @@ class AdminRawIdWidgetSeleniumFirefoxTests(AdminSeleniumWebDriverTestCase): self.selenium.switch_to.window('id_supporting_bands') self.wait_page_loaded() link = self.selenium.find_element_by_link_text('Bogey Blues') - self.assertTrue('/band/42/' in link.get_attribute('href')) + self.assertIn('/band/42/', link.get_attribute('href')) link.click() # The field now contains the selected band's id @@ -1093,7 +1093,7 @@ class AdminRawIdWidgetSeleniumFirefoxTests(AdminSeleniumWebDriverTestCase): self.selenium.switch_to.window('id_supporting_bands') self.wait_page_loaded() link = self.selenium.find_element_by_link_text('Green Potatoes') - self.assertTrue('/band/98/' in link.get_attribute('href')) + self.assertIn('/band/98/', link.get_attribute('href')) link.click() # The field now contains the two selected bands' ids diff --git a/tests/aggregation_regress/tests.py b/tests/aggregation_regress/tests.py index 1e2564ea44..b9daa63f1b 100644 --- a/tests/aggregation_regress/tests.py +++ b/tests/aggregation_regress/tests.py @@ -133,7 +133,7 @@ class AggregationTests(TestCase): rating=3.0 ) # Different DB backends return different types for the extra select computation - self.assertTrue(obj.manufacture_cost == 11.545 or obj.manufacture_cost == Decimal('11.545')) + self.assertIn(obj.manufacture_cost, (11.545, Decimal('11.545'))) # Order of the annotate/extra in the query doesn't matter obj = Book.objects.extra(select={'manufacture_cost': 'price * .5'}).annotate(mean_auth_age=Avg('authors__age')).get(pk=2) @@ -150,12 +150,12 @@ class AggregationTests(TestCase): rating=3.0 ) # Different DB backends return different types for the extra select computation - self.assertTrue(obj.manufacture_cost == 11.545 or obj.manufacture_cost == Decimal('11.545')) + self.assertIn(obj.manufacture_cost, (11.545, Decimal('11.545'))) # Values queries can be combined with annotate and extra obj = Book.objects.annotate(mean_auth_age=Avg('authors__age')).extra(select={'manufacture_cost': 'price * .5'}).values().get(pk=2) manufacture_cost = obj['manufacture_cost'] - self.assertTrue(manufacture_cost == 11.545 or manufacture_cost == Decimal('11.545')) + self.assertIn(manufacture_cost, (11.545, Decimal('11.545'))) del obj['manufacture_cost'] self.assertEqual(obj, { "contact_id": 3, @@ -174,7 +174,7 @@ class AggregationTests(TestCase): # matter obj = Book.objects.values().annotate(mean_auth_age=Avg('authors__age')).extra(select={'manufacture_cost': 'price * .5'}).get(pk=2) manufacture_cost = obj['manufacture_cost'] - self.assertTrue(manufacture_cost == 11.545 or manufacture_cost == Decimal('11.545')) + self.assertIn(manufacture_cost, (11.545, Decimal('11.545'))) del obj['manufacture_cost'] self.assertEqual(obj, { 'contact_id': 3, @@ -1156,15 +1156,15 @@ class JoinPromotionTests(TestCase): def test_existing_join_not_promoted(self): # No promotion for existing joins qs = Charlie.objects.filter(alfa__name__isnull=False).annotate(Count('alfa__name')) - self.assertTrue(' INNER JOIN ' in str(qs.query)) + self.assertIn(' INNER JOIN ', str(qs.query)) # Also, the existing join is unpromoted when doing filtering for already # promoted join. qs = Charlie.objects.annotate(Count('alfa__name')).filter(alfa__name__isnull=False) - self.assertTrue(' INNER JOIN ' in str(qs.query)) + self.assertIn(' INNER JOIN ', str(qs.query)) # But, as the join is nullable first use by annotate will be LOUTER qs = Charlie.objects.annotate(Count('alfa__name')) - self.assertTrue(' LEFT OUTER JOIN ' in str(qs.query)) + self.assertIn(' LEFT OUTER JOIN ', str(qs.query)) def test_non_nullable_fk_not_promoted(self): qs = Book.objects.annotate(Count('contact__name')) - self.assertTrue(' INNER JOIN ' in str(qs.query)) + self.assertIn(' INNER JOIN ', str(qs.query)) diff --git a/tests/backends/tests.py b/tests/backends/tests.py index 2ab8f680b5..be876cc089 100644 --- a/tests/backends/tests.py +++ b/tests/backends/tests.py @@ -392,7 +392,7 @@ class SequenceResetTest(TestCase): # If we create a new object now, it should have a PK greater # than the PK we specified manually. obj = models.Post.objects.create(name='New post', text='goodbye world') - self.assertTrue(obj.pk > 10) + self.assertGreater(obj.pk, 10) # This test needs to run outside of a transaction, otherwise closing the @@ -413,12 +413,12 @@ class ConnectionCreatedSignalTest(TransactionTestCase): connection_created.connect(receiver) connection.close() connection.cursor() - self.assertTrue(data["connection"].connection is connection.connection) + self.assertIs(data["connection"].connection, connection.connection) connection_created.disconnect(receiver) data.clear() connection.cursor() - self.assertTrue(data == {}) + self.assertEqual(data, {}) class EscapingChecks(TestCase): diff --git a/tests/basic/tests.py b/tests/basic/tests.py index 9ea0695e25..4f3e8a958f 100644 --- a/tests/basic/tests.py +++ b/tests/basic/tests.py @@ -134,7 +134,7 @@ class ModelInstanceCreationTests(TestCase): a.save() # You can use 'in' to test for membership... - self.assertTrue(a in Article.objects.all()) + self.assertIn(a, Article.objects.all()) # ... but there will often be more efficient ways if that is all you need: self.assertTrue(Article.objects.filter(id=a.id).exists()) @@ -171,12 +171,10 @@ class ModelTest(TestCase): some_pub_date = datetime(2014, 5, 16, 12, 1) a1 = Article.objects.create(headline='First', pub_date=some_pub_date) a2 = Article.objects.create(headline='Second', pub_date=some_pub_date) - self.assertTrue(a1 != a2) - self.assertFalse(a1 == a2) - self.assertTrue(a1 == Article.objects.get(id__exact=a1.id)) + self.assertNotEqual(a1, a2) + self.assertEqual(a1, Article.objects.get(id__exact=a1.id)) - self.assertTrue(Article.objects.get(id__exact=a1.id) != Article.objects.get(id__exact=a2.id)) - self.assertFalse(Article.objects.get(id__exact=a2.id) == Article.objects.get(id__exact=a1.id)) + self.assertNotEqual(Article.objects.get(id__exact=a1.id), Article.objects.get(id__exact=a2.id)) def test_multiple_objects_max_num_fetched(self): """ @@ -286,7 +284,7 @@ class ModelTest(TestCase): ) s = {a10, a11, a12} - self.assertTrue(Article.objects.get(headline='Article 11') in s) + self.assertIn(Article.objects.get(headline='Article 11'), s) def test_field_ordering(self): """ @@ -299,10 +297,10 @@ class ModelTest(TestCase): f1 = Field() f2 = Field(auto_created=True) f3 = Field() - self.assertTrue(f2 < f1) - self.assertTrue(f3 > f1) - self.assertFalse(f1 is None) - self.assertFalse(f2 in (None, 1, '')) + self.assertLess(f2, f1) + self.assertGreater(f3, f1) + self.assertIsNotNone(f1) + self.assertNotIn(f2, (None, 1, '')) def test_extra_method_select_argument_with_dashes_and_values(self): # The 'select' argument to extra() supports names with dashes in diff --git a/tests/bulk_create/tests.py b/tests/bulk_create/tests.py index f49fe4e54e..742e52fec8 100644 --- a/tests/bulk_create/tests.py +++ b/tests/bulk_create/tests.py @@ -116,7 +116,7 @@ class BulkCreateTests(TestCase): TwoFields.objects.bulk_create([ TwoFields(f1=i, f2=i + 1) for i in range(0, 1001) ]) - self.assertTrue(len(connection.queries) < 10) + self.assertLess(len(connection.queries), 10) def test_large_batch_mixed(self): """ @@ -146,7 +146,7 @@ class BulkCreateTests(TestCase): TwoFields.objects.bulk_create([ TwoFields(id=i if i % 2 == 0 else None, f1=i, f2=i + 1) for i in range(100000, 101000)]) - self.assertTrue(len(connection.queries) < 10) + self.assertLess(len(connection.queries), 10) def test_explicit_batch_size(self): objs = [TwoFields(f1=i, f2=i) for i in range(0, 4)] diff --git a/tests/cache/tests.py b/tests/cache/tests.py index ee003e9cac..3ad1979af4 100644 --- a/tests/cache/tests.py +++ b/tests/cache/tests.py @@ -2084,7 +2084,7 @@ class CacheHandlerTest(TestCase): cache1 = caches['default'] cache2 = caches['default'] - self.assertTrue(cache1 is cache2) + self.assertIs(cache1, cache2) def test_per_thread(self): """ @@ -2101,4 +2101,4 @@ class CacheHandlerTest(TestCase): t.start() t.join() - self.assertFalse(c[0] is c[1]) + self.assertIsNot(c[0], c[1]) diff --git a/tests/csrf_tests/tests.py b/tests/csrf_tests/tests.py index b12e409955..ee19017515 100644 --- a/tests/csrf_tests/tests.py +++ b/tests/csrf_tests/tests.py @@ -119,7 +119,7 @@ class CsrfViewMiddlewareTest(TestCase): self.assertEqual(csrf_cookie['secure'], True) self.assertEqual(csrf_cookie['httponly'], True) self.assertEqual(csrf_cookie['path'], '/test/') - self.assertTrue('Cookie' in resp2.get('Vary', '')) + self.assertIn('Cookie', resp2.get('Vary', '')) def test_process_response_get_token_not_used(self): """ @@ -340,7 +340,7 @@ class CsrfViewMiddlewareTest(TestCase): req = self._get_GET_no_csrf_cookie_request() resp = view(req) self.assertTrue(resp.cookies.get(settings.CSRF_COOKIE_NAME, False)) - self.assertTrue('Cookie' in resp.get('Vary', '')) + self.assertIn('Cookie', resp.get('Vary', '')) def test_ensures_csrf_cookie_with_middleware(self): """ @@ -357,7 +357,7 @@ class CsrfViewMiddlewareTest(TestCase): resp = view(req) resp2 = CsrfViewMiddleware().process_response(req, resp) self.assertTrue(resp2.cookies.get(settings.CSRF_COOKIE_NAME, False)) - self.assertTrue('Cookie' in resp2.get('Vary', '')) + self.assertIn('Cookie', resp2.get('Vary', '')) def test_ensures_csrf_cookie_no_logging(self): """ diff --git a/tests/datatypes/tests.py b/tests/datatypes/tests.py index e55405983d..4b21d4e6e2 100644 --- a/tests/datatypes/tests.py +++ b/tests/datatypes/tests.py @@ -14,7 +14,7 @@ class DataTypesTestCase(TestCase): def test_boolean_type(self): d = Donut(name='Apple Fritter') self.assertFalse(d.is_frosted) - self.assertTrue(d.has_sprinkles is None) + self.assertIsNone(d.has_sprinkles) d.has_sprinkles = True self.assertTrue(d.has_sprinkles) diff --git a/tests/empty/tests.py b/tests/empty/tests.py index 7cebb87c2a..1d98aa4e84 100644 --- a/tests/empty/tests.py +++ b/tests/empty/tests.py @@ -6,10 +6,10 @@ from .models import Empty class EmptyModelTests(TestCase): def test_empty(self): m = Empty() - self.assertEqual(m.id, None) + self.assertIsNone(m.id) m.save() Empty.objects.create() self.assertEqual(len(Empty.objects.all()), 2) - self.assertTrue(m.id is not None) + self.assertIsNotNone(m.id) existing = Empty(m.id) existing.save() diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py index 36cb95a5f7..1bd8d7465c 100644 --- a/tests/expressions/tests.py +++ b/tests/expressions/tests.py @@ -210,7 +210,7 @@ class ExpressionsTests(TestCase): # keys, or attributes which involve joins. test_gmbh.point_of_contact = None test_gmbh.save() - self.assertTrue(test_gmbh.point_of_contact is None) + self.assertIsNone(test_gmbh.point_of_contact) def test(): test_gmbh.point_of_contact = F("ceo") diff --git a/tests/field_defaults/tests.py b/tests/field_defaults/tests.py index d9f28d8c5c..031fd75fe3 100644 --- a/tests/field_defaults/tests.py +++ b/tests/field_defaults/tests.py @@ -14,4 +14,4 @@ class DefaultTests(TestCase): self.assertIsInstance(a.id, six.integer_types) self.assertEqual(a.headline, "Default headline") - self.assertTrue((now - a.pub_date).seconds < 5) + self.assertLess((now - a.pub_date).seconds, 5) diff --git a/tests/file_storage/tests.py b/tests/file_storage/tests.py index 4e6fe869a1..e1938e9ea5 100644 --- a/tests/file_storage/tests.py +++ b/tests/file_storage/tests.py @@ -138,7 +138,7 @@ class FileStorageTests(unittest.TestCase): self.assertEqual(atime, datetime.fromtimestamp( os.path.getatime(self.storage.path(f_name)))) - self.assertTrue(datetime.now() - self.storage.accessed_time(f_name) < timedelta(seconds=2)) + self.assertLess(datetime.now() - self.storage.accessed_time(f_name), timedelta(seconds=2)) self.storage.delete(f_name) def test_file_created_time(self): @@ -154,7 +154,7 @@ class FileStorageTests(unittest.TestCase): self.assertEqual(ctime, datetime.fromtimestamp( os.path.getctime(self.storage.path(f_name)))) - self.assertTrue(datetime.now() - self.storage.created_time(f_name) < timedelta(seconds=2)) + self.assertLess(datetime.now() - self.storage.created_time(f_name), timedelta(seconds=2)) self.storage.delete(f_name) @@ -171,7 +171,7 @@ class FileStorageTests(unittest.TestCase): self.assertEqual(mtime, datetime.fromtimestamp( os.path.getmtime(self.storage.path(f_name)))) - self.assertTrue(datetime.now() - self.storage.modified_time(f_name) < timedelta(seconds=2)) + self.assertLess(datetime.now() - self.storage.modified_time(f_name), timedelta(seconds=2)) self.storage.delete(f_name) @@ -459,7 +459,7 @@ class FileFieldStorageTests(unittest.TestCase): obj1.normal = SimpleUploadedFile("assignment.txt", b"content") dirs, files = temp_storage.listdir("tests") self.assertEqual(dirs, []) - self.assertFalse("assignment.txt" in files) + self.assertNotIn("assignment.txt", files) obj1.save() dirs, files = temp_storage.listdir("tests") diff --git a/tests/file_uploads/tests.py b/tests/file_uploads/tests.py index 66d055e8cf..fe1a79fc9f 100644 --- a/tests/file_uploads/tests.py +++ b/tests/file_uploads/tests.py @@ -257,7 +257,7 @@ class FileUploadTests(TestCase): for name, _, expected in cases: got = result[name] self.assertEqual(expected, got, 'Mismatch for {0}'.format(name)) - self.assertTrue(len(got) < 256, + self.assertLess(len(got), 256, "Got a long file name (%s characters)." % len(got)) def test_content_type_extra(self): @@ -336,12 +336,12 @@ class FileUploadTests(TestCase): # Small file posting should work. response = self.client.post('/quota/', {'f': smallfile}) got = json.loads(response.content.decode('utf-8')) - self.assertTrue('f' in got) + self.assertIn('f', got) # Large files don't go through. response = self.client.post("/quota/", {'f': bigfile}) got = json.loads(response.content.decode('utf-8')) - self.assertTrue('f' not in got) + self.assertNotIn('f', got) def test_broken_custom_upload_handler(self): with tempfile.NamedTemporaryFile() as file: diff --git a/tests/fixtures_model_package/tests.py b/tests/fixtures_model_package/tests.py index d9f8c7f490..fd48dc1f9c 100644 --- a/tests/fixtures_model_package/tests.py +++ b/tests/fixtures_model_package/tests.py @@ -123,7 +123,6 @@ class InitialSQLTests(TestCase): out = StringIO() management.call_command("sqlcustom", "fixtures_model_package", stdout=out) output = out.getvalue() - self.assertTrue("INSERT INTO fixtures_model_package_book (name) " - "VALUES ('My Book')" in output) + self.assertIn("INSERT INTO fixtures_model_package_book (name) VALUES ('My Book')", output) # value from deprecated search path models/sql (remove in Django 1.9) - self.assertTrue("Deprecated Book" in output) + self.assertIn("Deprecated Book", output) diff --git a/tests/foreign_object/tests.py b/tests/foreign_object/tests.py index f361c5c8d5..fd34a05013 100644 --- a/tests/foreign_object/tests.py +++ b/tests/foreign_object/tests.py @@ -319,7 +319,7 @@ class MultiColumnFKTests(TestCase): with self.assertNumQueries(1): fetched = Article.objects.select_related('active_translation').get( active_translation__title='Otsikko') - self.assertTrue(fetched.active_translation.title == 'Otsikko') + self.assertEqual(fetched.active_translation.title, 'Otsikko') a2 = Article.objects.create(pub_date=datetime.date.today()) at2_fi = ArticleTranslation(article=a2, lang='fi', title='Atsikko', body='Diipadaapa', abstract='dipad') diff --git a/tests/forms_tests/tests/test_extra.py b/tests/forms_tests/tests/test_extra.py index 6ec1a62932..1d53a9bd1d 100644 --- a/tests/forms_tests/tests/test_extra.py +++ b/tests/forms_tests/tests/test_extra.py @@ -318,7 +318,7 @@ class FormsExtraTestCase(TestCase, AssertFormErrorsMixin): # label tag is correctly associated with month dropdown d = GetDate({'mydate_month': '1', 'mydate_day': '1', 'mydate_year': '2010'}) - self.assertTrue('