Graham Higgins committed ea3a786

Neatening up.

  • Participants
  • Parent commits 2491a6d

Comments (0)

Files changed (5)

 import sys
-PY3 = True if sys.version_info[:1] == (3,) else False
+PY3 = (sys.version_info[0] >= 3)
     from io import StringIO
 except ImportError:


         if v1 == '&ignore' or v2 == '&ignore':
   'Ignored comparison for key: %s', key)
-        if not isinstance(v2, str) and isinstance(v1, str):
+        if not isinstance(v2, six.text_type) and isinstance(v1, six.text_type):
             if not eq_pprint(type(v1), type(v2)):
                     'The types of values for "%s" do not match (%s vs. %s)' %
 def eq_json(a, b):
-    if isinstance(a, str):
+    if isinstance(a, six.text_type):
         a = loads(a)
-    if isinstance(b, str):
+    if isinstance(b, six.text_type):
         b = loads(b)
     return eq_dict(a, b)


     encodingdecl = ''
     if encoding is not None:
         EncName_re = re.compile(r'[A-Za-z][A-Za-z0-9._-]*\Z')  # from XML spec
-        if isinstance(encoding, str) and EncName_re.match(encoding):
+        if isinstance(encoding, six.text_type) and EncName_re.match(encoding):
             encodingdecl = ' encoding="%s"' % encoding
             # Don't tell them expected format, guessing won't help


 from __future__ import print_function
-import sys
-PY3 = True if sys.version_info[:1] == (3,) else False
+from import call_super, STestCase, DelayedException
+from strainer.xhtmlify import PY3
+from import eq_, raises
-from import call_super, STestCase, DelayedException
-from import eq_, raises
 class FooTest(STestCase):
     def setUp(self):


 import re
 import encodings.aliases
 import codecs
-import sys
-PY3 = True if sys.version_info[:1] == (3,) else False
 from strainer.xhtmlify import xhtmlify as _xhtmlify, xmlparse, ValidationError
 from strainer.xhtmlify import sniff_encoding, fix_xmldecl
 from strainer.doctypes import DOCTYPE_XHTML1_STRICT