[GRASS-SVN] r74361 - in grass/trunk/lib/python: gunittest temporal

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Apr 10 00:50:29 PDT 2019


Author: sbl
Date: 2019-04-10 00:50:29 -0700 (Wed, 10 Apr 2019)
New Revision: 74361

Modified:
   grass/trunk/lib/python/gunittest/case.py
   grass/trunk/lib/python/temporal/datetime_math.py
   grass/trunk/lib/python/temporal/temporal_algebra.py
Log:
Py>=3 version checks

Modified: grass/trunk/lib/python/gunittest/case.py
===================================================================
--- grass/trunk/lib/python/gunittest/case.py	2019-04-09 18:30:15 UTC (rev 74360)
+++ grass/trunk/lib/python/gunittest/case.py	2019-04-10 07:50:29 UTC (rev 74361)
@@ -172,7 +172,7 @@
         # 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 @@
         # 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 @@
         # 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)

Modified: grass/trunk/lib/python/temporal/datetime_math.py
===================================================================
--- grass/trunk/lib/python/temporal/datetime_math.py	2019-04-09 18:30:15 UTC (rev 74360)
+++ grass/trunk/lib/python/temporal/datetime_math.py	2019-04-10 07:50:29 UTC (rev 74361)
@@ -19,7 +19,7 @@
 except:
     has_dateutil = False
 
-if sys.version_info[0] == 3:
+if sys.version_info[0] >= 3:
     unicode = str
 
 DAY_IN_SECONDS = 86400

Modified: grass/trunk/lib/python/temporal/temporal_algebra.py
===================================================================
--- grass/trunk/lib/python/temporal/temporal_algebra.py	2019-04-09 18:30:15 UTC (rev 74360)
+++ grass/trunk/lib/python/temporal/temporal_algebra.py	2019-04-10 07:50:29 UTC (rev 74361)
@@ -470,7 +470,7 @@
 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
 
 ##############################################################################



More information about the grass-commit mailing list