Explorar o código

Py>=3 version checks

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@74361 15284696-431f-4ddb-bdfa-cd5b030d7da7
Stefan Blumentrath %!s(int64=6) %!d(string=hai) anos
pai
achega
dc559b9ad4

+ 3 - 3
lib/python/gunittest/case.py

@@ -172,7 +172,7 @@ class TestCase(unittest.TestCase):
         # SimpleModule delivers bytes for stderr and stdout
         # Instead of decoding stdout and stderr in every test, decoding
         # is done here
-        if pyversion == 3:
+        if pyversion >= 3:
             if isinstance(first, bytes):
                 first = decode(first)
             if isinstance(second, bytes):
@@ -196,7 +196,7 @@ class TestCase(unittest.TestCase):
         # SimpleModule delivers bytes for stderr and stdout
         # Instead of decoding stdout and stderr in every test, decoding
         # is done here
-        if pyversion == 3:
+        if pyversion >= 3:
             if isinstance(actual, bytes):
                 actual = decode(actual)
         self.assertTrue(isinstance(actual, str), (
@@ -421,7 +421,7 @@ class TestCase(unittest.TestCase):
         # SimpleModule delivers bytes for stderr and stdout
         # Instead of decoding stdout and stderr in every test, decoding
         # is done here
-        if pyversion == 3:
+        if pyversion >= 3:
             if isinstance(actual, bytes):
                 actual = decode(actual)
         module = SimpleModule('v.info', flags='t', map=reference)

+ 1 - 1
lib/python/temporal/datetime_math.py

@@ -19,7 +19,7 @@ try:
 except:
     has_dateutil = False
 
-if sys.version_info[0] == 3:
+if sys.version_info[0] >= 3:
     unicode = str
 
 DAY_IN_SECONDS = 86400

+ 1 - 1
lib/python/temporal/temporal_algebra.py

@@ -470,7 +470,7 @@ from .datetime_math import create_suffix_from_datetime
 from .datetime_math import create_time_suffix
 from .datetime_math import create_numeric_suffix
 
-if sys.version_info[0] == 3:
+if sys.version_info[0] >= 3:
     unicode = str
 
 ##############################################################################