diff options
| author | Tim Graham <timograham@gmail.com> | 2015-06-15 10:37:14 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-06-15 11:27:09 -0400 |
| commit | 47fcbe506c04019a12e16221843e25a52249b1ab (patch) | |
| tree | 0ad523fef8859042a09b3de8dc3977ae48c23701 /tests | |
| parent | ccfb5c74083ac565c66a2d0cfe11e60e7d1c8337 (diff) | |
Fixed flake8 warnings on Python 3.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/i18n/tests.py | 7 | ||||
| -rw-r--r-- | tests/model_fields/tests.py | 5 | ||||
| -rw-r--r-- | tests/queries/tests.py | 9 |
3 files changed, 13 insertions, 8 deletions
diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py index 24951633de..a4e6fc9fc2 100644 --- a/tests/i18n/tests.py +++ b/tests/i18n/tests.py @@ -208,7 +208,10 @@ class TranslationTests(SimpleTestCase): result = ungettext_lazy('%(name)s has %(num)d good result', '%(name)s has %(num)d good results', 4) self.assertEqual(result % {'name': 'Joe', 'num': 4}, "Joe has 4 good results") # Now with a long - result = ungettext_lazy('%(name)s has %(num)d good result', '%(name)s has %(num)d good results', long(4)) + result = ungettext_lazy( + '%(name)s has %(num)d good result', '%(name)s has %(num)d good results', + long(4) # NOQA: long undefined on PY3 + ) self.assertEqual(result % {'name': 'Joe', 'num': 4}, "Joe has 4 good results") @override_settings(LOCALE_PATHS=extended_locale_paths) @@ -470,7 +473,7 @@ class FormattingTests(SimpleTestCase): self.d = datetime.date(2009, 12, 31) self.dt = datetime.datetime(2009, 12, 31, 20, 50) self.t = datetime.time(10, 15, 48) - self.l = 10000 if PY3 else long(10000) + self.l = 10000 if PY3 else long(10000) # NOQA: long undefined on PY3 self.ctxt = Context({ 'n': self.n, 't': self.t, diff --git a/tests/model_fields/tests.py b/tests/model_fields/tests.py index 939ba269d8..353c15f491 100644 --- a/tests/model_fields/tests.py +++ b/tests/model_fields/tests.py @@ -797,10 +797,11 @@ class PromiseTest(test.SimpleTestCase): @unittest.skipIf(six.PY3, "Python 3 has no `long` type.") def test_BigIntegerField(self): - lazy_func = lazy(lambda: long(9999999999999999999), long) + # NOQA: long undefined on PY3 + lazy_func = lazy(lambda: long(9999999999999999999), long) # NOQA self.assertIsInstance( BigIntegerField().get_prep_value(lazy_func()), - long) + long) # NOQA def test_BinaryField(self): lazy_func = lazy(lambda: b'', bytes) diff --git a/tests/queries/tests.py b/tests/queries/tests.py index 71c32c6bda..36bbdfea29 100644 --- a/tests/queries/tests.py +++ b/tests/queries/tests.py @@ -2245,17 +2245,18 @@ class QuerySetSupportsPythonIdioms(TestCase): @unittest.skipUnless(six.PY2, "Python 2 only -- Python 3 doesn't have longs.") def test_slicing_works_with_longs(self): - self.assertEqual(self.get_ordered_articles()[long(0)].name, 'Article 1') - self.assertQuerysetEqual(self.get_ordered_articles()[long(1):long(3)], + # NOQA: long undefined on PY3 + self.assertEqual(self.get_ordered_articles()[long(0)].name, 'Article 1') # NOQA + self.assertQuerysetEqual(self.get_ordered_articles()[long(1):long(3)], # NOQA ["<Article: Article 2>", "<Article: Article 3>"]) - self.assertQuerysetEqual(self.get_ordered_articles()[::long(2)], + self.assertQuerysetEqual(self.get_ordered_articles()[::long(2)], # NOQA ["<Article: Article 1>", "<Article: Article 3>", "<Article: Article 5>", "<Article: Article 7>"]) # And can be mixed with ints. - self.assertQuerysetEqual(self.get_ordered_articles()[1:long(3)], + self.assertQuerysetEqual(self.get_ordered_articles()[1:long(3)], # NOQA ["<Article: Article 2>", "<Article: Article 3>"]) def test_slicing_without_step_is_lazy(self): |
