summaryrefslogtreecommitdiff
path: root/tests/utils_tests/test_encoding.py
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2016-12-01 11:38:01 +0100
committerClaude Paroz <claude@2xlibre.net>2017-01-18 16:21:28 +0100
commitc716fe87821df00f9f03ecc761c914d1682591a2 (patch)
tree0436706cdb190acbc76fb5fcf6d66f16e09fafa3 /tests/utils_tests/test_encoding.py
parente63d98b7beb16d1410168a2315cbe04c43c9c80d (diff)
Refs #23919 -- Removed six.PY2/PY3 usage
Thanks Tim Graham for the review.
Diffstat (limited to 'tests/utils_tests/test_encoding.py')
-rw-r--r--tests/utils_tests/test_encoding.py29
1 files changed, 8 insertions, 21 deletions
diff --git a/tests/utils_tests/test_encoding.py b/tests/utils_tests/test_encoding.py
index 1d6976fc77..b4e7b9c0ac 100644
--- a/tests/utils_tests/test_encoding.py
+++ b/tests/utils_tests/test_encoding.py
@@ -21,10 +21,8 @@ class TestEncodingUtils(unittest.TestCase):
__unicode__ = __str__
- # str(s) raises a TypeError on python 3 if the result is not a text type.
- # python 2 fails when it tries converting from str to unicode (via ASCII).
- exception = TypeError if six.PY3 else UnicodeError
- with self.assertRaises(exception):
+ # str(s) raises a TypeError if the result is not a text type.
+ with self.assertRaises(TypeError):
force_text(MyString())
def test_force_text_lazy(self):
@@ -47,26 +45,15 @@ class TestEncodingUtils(unittest.TestCase):
def test_smart_text(self):
class Test:
- if six.PY3:
- def __str__(self):
- return 'ŠĐĆŽćžšđ'
- else:
- def __str__(self):
- return 'ŠĐĆŽćžšđ'.encode('utf-8')
+ def __str__(self):
+ return 'ŠĐĆŽćžšđ'
class TestU:
- if six.PY3:
- def __str__(self):
- return 'ŠĐĆŽćžšđ'
-
- def __bytes__(self):
- return b'Foo'
- else:
- def __str__(self):
- return b'Foo'
+ def __str__(self):
+ return 'ŠĐĆŽćžšđ'
- def __unicode__(self):
- return '\u0160\u0110\u0106\u017d\u0107\u017e\u0161\u0111'
+ def __bytes__(self):
+ return b'Foo'
self.assertEqual(smart_text(Test()), '\u0160\u0110\u0106\u017d\u0107\u017e\u0161\u0111')
self.assertEqual(smart_text(TestU()), '\u0160\u0110\u0106\u017d\u0107\u017e\u0161\u0111')