Clean up, remove compat with py < 3.6
[pyi2ncommon] / test / test_type_helpers.py
index c9cb289..c32277f 100644 (file)
@@ -20,7 +20,7 @@
 
 """ type_helper_unittest.py: unit tests for type_helpers
 
-Tests classes and functions in type_helpers
+Test classes and functions in type_helpers
 
 Should be run from python2 and python3!
 
@@ -28,23 +28,13 @@ For help see :py:mod:`unittest`
 """
 
 import unittest
-
-from src.type_helpers import is_unicode, isstr
 from sys import version_info
 
+from src.type_helpers import is_unicode, isstr
 
-is_py2 = version_info.major == 2
 
 class TypeHelperTester(unittest.TestCase):
 
-    def test_is_py2_or_py3(self):
-        """ test that python version is 2 or 3
-
-        when implementing type_helpers, there was no py4 and no idea what it
-        might be like. Also will probably fail for python v1
-        """
-        self.assertIn(version_info.major, (2, 3))
-
     def test_is_unicode(self):
         """ tests function is_unicode """
 
@@ -53,25 +43,18 @@ class TypeHelperTester(unittest.TestCase):
         self.assertFalse(is_unicode(unittest.TestCase))
         self.assertFalse(is_unicode(type(unittest.TestCase)))
 
-        if is_py2:
-            self.assertTrue(is_unicode(u'bla'))
-            self.assertTrue(eval("is_unicode(ur'bla')"))  # not allowed in py3!
-            self.assertFalse(is_unicode('bla'))
-            self.assertFalse(is_unicode(r'bla'))
-        else:
-            self.assertTrue(is_unicode('bla'))
-            self.assertTrue(is_unicode(r'bla'))
-            self.assertFalse(is_unicode(b'bla'))
-            self.assertFalse(is_unicode(br'bla'))
+        self.assertTrue(is_unicode('bla'))
+        self.assertTrue(is_unicode(r'bla'))
+        self.assertFalse(is_unicode(b'bla'))
+        self.assertFalse(is_unicode(br'bla'))
 
     def test_isstr(self):
         """ test function isstr """
 
         tests = [
             ('abc', True), (u'abc', True), (r'abc', True),
-            (1, False), (['a', 'b', 'c'], False), (('a', 'b', 'c'), False)]
-        if not is_py2:
-            tests.append((b'abc', False))  # b'' does not exist in py2
+            (1, False), (['a', 'b', 'c'], False), (('a', 'b', 'c'), False),
+            (b'abc', False)]
 
         for test_var, expected_result in tests:
             self.assertEqual(isstr(test_var), expected_result,