Просмотр исходного кода

testsuite: gunnitest.test_checkers update for Python3 (fixes https://trac.osgeo.org/grass/ticket/3821) (contributed by pmav99)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@74406 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Neteler 6 лет назад
Родитель
Сommit
ce49292955

+ 1 - 1
lib/python/gunittest/checkers.py

@@ -603,7 +603,7 @@ def text_file_md5(filename, exclude_lines=None, exclude_re=None,
                 continue
             if exclude_re and regexp.match(line):
                 continue
-            hasher.update(line)
+            hasher.update(line.encode("utf-8"))
     if append_lines:
         for line in append_lines:
             hasher.update(line)

+ 3 - 3
lib/python/gunittest/testsuite/test_checkers.py

@@ -190,9 +190,9 @@ class TestTextToKeyValue(TestCase):
         # although it does not support stripping (we don't merge separators)
         keyvals = text_to_keyvalue("a 1 2 3", sep=' ', val_sep=' ')
         self.assertDictEqual({'a': [1, 2, 3]}, keyvals)
-        
+
     #def test_projection_files(self):
-        
+
 # obtained by r.univar elevation -g
 # floats removed
 R_UNIVAR_KEYVAL = """n=2025000
@@ -354,7 +354,7 @@ class TestMd5Sums(TestCase):
             for line in CORRECT_LINES:
                 # \n should be converted to platform newline
                 f.write(line + '\n')
-        with open(cls.correct_file_name_unix_nl, 'wb') as f:
+        with open(cls.correct_file_name_unix_nl, 'w') as f:
             for line in CORRECT_LINES:
                 # binary mode will write pure \n
                 f.write(line + '\n')