diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-09-02 12:06:32 +0200 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-09-02 12:11:02 +0200 |
| commit | 365c3e8b73eab825a8ecd0cf8046e1a0824ccd45 (patch) | |
| tree | f22f78037da5fa34250851e1dace72c4b2e77e78 /tests | |
| parent | 4292097078279226cb725c2921011fb14634b9af (diff) | |
Replaced "not PY3" by "PY2", new in six 1.4.0.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/base/models.py | 2 | ||||
| -rw-r--r-- | tests/basic/tests.py | 2 | ||||
| -rw-r--r-- | tests/defaultfilters/tests.py | 2 | ||||
| -rw-r--r-- | tests/httpwrappers/tests.py | 14 | ||||
| -rw-r--r-- | tests/i18n/tests.py | 2 | ||||
| -rw-r--r-- | tests/signing/tests.py | 4 | ||||
| -rw-r--r-- | tests/test_utils/doctest_output.py | 2 | ||||
| -rw-r--r-- | tests/utils_tests/test_datastructures.py | 2 | ||||
| -rw-r--r-- | tests/utils_tests/test_http.py | 4 | ||||
| -rw-r--r-- | tests/utils_tests/test_simplelazyobject.py | 2 |
10 files changed, 18 insertions, 18 deletions
diff --git a/tests/base/models.py b/tests/base/models.py index d47ddcfd66..98d379337c 100644 --- a/tests/base/models.py +++ b/tests/base/models.py @@ -19,7 +19,7 @@ class MyModel(six.with_metaclass(CustomBaseModel, models.Model)): # This is done to ensure that for Python2 only, defining metaclasses # still does not fail to create the model. -if not six.PY3: +if six.PY2: class MyModel(models.Model): """Model subclass with a custom base using __metaclass__.""" __metaclass__ = CustomBaseModel diff --git a/tests/basic/tests.py b/tests/basic/tests.py index 2204989823..fb3b06a543 100644 --- a/tests/basic/tests.py +++ b/tests/basic/tests.py @@ -373,7 +373,7 @@ class ModelTest(TestCase): "<Article: Third article>"]) # Slicing works with longs (Python 2 only -- Python 3 doesn't have longs). - if not six.PY3: + if six.PY2: self.assertEqual(Article.objects.all()[long(0)], a) self.assertQuerysetEqual(Article.objects.all()[long(1):long(3)], ["<Article: Second article>", "<Article: Third article>"]) diff --git a/tests/defaultfilters/tests.py b/tests/defaultfilters/tests.py index 7db872001d..86bdbf9992 100644 --- a/tests/defaultfilters/tests.py +++ b/tests/defaultfilters/tests.py @@ -89,7 +89,7 @@ class DefaultFiltersTests(TestCase): # The test above fails because of Python 2's float handling. Floats with # many zeroes after the decimal point should be passed in as another type # such as unicode or Decimal. - if not six.PY3: + if six.PY2: test_floatformat_py2_fail = unittest.expectedFailure(test_floatformat_py2_fail) diff --git a/tests/httpwrappers/tests.py b/tests/httpwrappers/tests.py index 4ee342c252..356818d2ef 100644 --- a/tests/httpwrappers/tests.py +++ b/tests/httpwrappers/tests.py @@ -46,7 +46,7 @@ class QueryDictTests(unittest.TestCase): def test_immutable_basic_operations(self): q = QueryDict(str('')) self.assertEqual(q.getlist('foo'), []) - if not six.PY3: + if six.PY2: self.assertEqual(q.has_key('foo'), False) self.assertEqual('foo' in q, False) self.assertEqual(list(six.iteritems(q)), []) @@ -72,10 +72,10 @@ class QueryDictTests(unittest.TestCase): self.assertRaises(AttributeError, q.setlist, 'foo', ['bar']) self.assertRaises(AttributeError, q.appendlist, 'foo', ['bar']) - if not six.PY3: + if six.PY2: self.assertTrue(q.has_key('foo')) self.assertTrue('foo' in q) - if not six.PY3: + if six.PY2: self.assertFalse(q.has_key('bar')) self.assertFalse('bar' in q) @@ -131,7 +131,7 @@ class QueryDictTests(unittest.TestCase): q.appendlist('foo', 'another') self.assertEqual(q.getlist('foo'), ['bar', 'baz', 'another']) self.assertEqual(q['foo'], 'another') - if not six.PY3: + if six.PY2: self.assertTrue(q.has_key('foo')) self.assertTrue('foo' in q) @@ -176,10 +176,10 @@ class QueryDictTests(unittest.TestCase): self.assertRaises(AttributeError, q.setlist, 'foo', ['bar', 'baz']) self.assertRaises(AttributeError, q.appendlist, 'foo', ['bar']) - if not six.PY3: + if six.PY2: self.assertEqual(q.has_key('vote'), True) self.assertEqual('vote' in q, True) - if not six.PY3: + if six.PY2: self.assertEqual(q.has_key('foo'), False) self.assertEqual('foo' in q, False) self.assertEqual(list(six.iteritems(q)), [('vote', 'no')]) @@ -195,7 +195,7 @@ class QueryDictTests(unittest.TestCase): self.assertRaises(AttributeError, q.setdefault, 'foo', 'bar') self.assertRaises(AttributeError, q.__delitem__, 'vote') - if not six.PY3: + if six.PY2: def test_invalid_input_encoding(self): """ QueryDicts must be able to handle invalid input encoding (in this diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py index 12e325b773..cd167616e7 100644 --- a/tests/i18n/tests.py +++ b/tests/i18n/tests.py @@ -89,7 +89,7 @@ class TranslationTests(TransRealMixin, TestCase): s4 = ugettext_lazy('Some other string') self.assertEqual(False, s == s4) - if not six.PY3: + if six.PY2: # On Python 2, gettext_lazy should not transform a bytestring to unicode self.assertEqual(gettext_lazy(b"test").upper(), b"TEST") diff --git a/tests/signing/tests.py b/tests/signing/tests.py index 05c8b3dc74..5c5c2b1da7 100644 --- a/tests/signing/tests.py +++ b/tests/signing/tests.py @@ -48,7 +48,7 @@ class TestSigner(TestCase): 'jkw osanteuh ,rcuh nthu aou oauh ,ud du', '\u2019', ] - if not six.PY3: + if six.PY2: examples.append(b'a byte string') for example in examples: signed = signer.sign(example) @@ -79,7 +79,7 @@ class TestSigner(TestCase): 'a unicode string \u2019', {'a': 'dictionary'}, ] - if not six.PY3: + if six.PY2: objects.append(b'a byte string') for o in objects: self.assertNotEqual(o, signing.dumps(o)) diff --git a/tests/test_utils/doctest_output.py b/tests/test_utils/doctest_output.py index 724364428a..0d1e94d037 100644 --- a/tests/test_utils/doctest_output.py +++ b/tests/test_utils/doctest_output.py @@ -59,7 +59,7 @@ __test__ = {"API_TEST": r""" """} -if not six.PY3: +if six.PY2: __test__["API_TEST"] += """ >>> def produce_long(): ... return 42L diff --git a/tests/utils_tests/test_datastructures.py b/tests/utils_tests/test_datastructures.py index 5563a0fc4f..7984837053 100644 --- a/tests/utils_tests/test_datastructures.py +++ b/tests/utils_tests/test_datastructures.py @@ -49,7 +49,7 @@ class SortedDictTests(SimpleTestCase): self.d2[7] = 'lucky number 7' self.assertEqual(list(six.iterkeys(self.d2)), [1, 9, 0, 7]) - if not six.PY3: + if six.PY2: def test_change_keys(self): """ Changing the keys won't do anything, it's only a copy of the diff --git a/tests/utils_tests/test_http.py b/tests/utils_tests/test_http.py index 581eb1dcd7..f68ac33503 100644 --- a/tests/utils_tests/test_http.py +++ b/tests/utils_tests/test_http.py @@ -115,12 +115,12 @@ class TestUtilsHttp(unittest.TestCase): # reciprocity works for n in [0, 1, 1000, 1000000]: self.assertEqual(n, http.base36_to_int(http.int_to_base36(n))) - if not six.PY3: + if six.PY2: self.assertEqual(sys.maxint, http.base36_to_int(http.int_to_base36(sys.maxint))) # bad input self.assertRaises(ValueError, http.int_to_base36, -1) - if not six.PY3: + if six.PY2: self.assertRaises(ValueError, http.int_to_base36, sys.maxint + 1) for n in ['1', 'foo', {1: 2}, (1, 2, 3), 3.141]: self.assertRaises(TypeError, http.int_to_base36, n) diff --git a/tests/utils_tests/test_simplelazyobject.py b/tests/utils_tests/test_simplelazyobject.py index f16b5e4da1..8dd427e86a 100644 --- a/tests/utils_tests/test_simplelazyobject.py +++ b/tests/utils_tests/test_simplelazyobject.py @@ -181,7 +181,7 @@ class TestUtilsSimpleLazyObject(TestCase): pickled = pickle.dumps(x, 1) pickled = pickle.dumps(x, 2) - if not six.PY3: + if six.PY2: import cPickle # This would fail with "TypeError: expected string or Unicode object, NoneType found". |
