[pygobject] tests: some more C locale fixes



commit fd5f2a09ce48329d2df191eca9a0cea926ddfb5b
Author: Christoph Reiter <creiter src gnome org>
Date:   Fri Oct 13 15:29:40 2017 +0200

    tests: some more C locale fixes
    
    see f40df0a09803ec9c729d842f1f83c6d56aebac22

 tests/test_everything.py |    8 +++++++-
 tests/test_gi.py         |    6 ++++--
 2 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/tests/test_everything.py b/tests/test_everything.py
index 0378781..db7b2d9 100644
--- a/tests/test_everything.py
+++ b/tests/test_everything.py
@@ -7,6 +7,7 @@ import traceback
 import ctypes
 import warnings
 import sys
+import os
 
 from gi.repository import Regress as Everything
 from gi.repository import GObject
@@ -19,6 +20,7 @@ try:
 except:
     Gtk = None
 
+from compathelper import PY3
 from helper import capture_exceptions
 
 
@@ -246,7 +248,11 @@ class TestEverything(unittest.TestCase):
         self.assertEqual(Everything.test_utf8_inout(const_str), noconst_str)
 
     def test_filename_return(self):
-        self.assertEqual(Everything.test_filename_return(), ['åäö', '/etc/fstab'])
+        if PY3:
+            result = [os.fsdecode(b'\xc3\xa5\xc3\xa4\xc3\xb6'), '/etc/fstab']
+        else:
+            result = ['åäö', '/etc/fstab']
+        self.assertEqual(Everything.test_filename_return(), result)
 
     def test_int_out_utf8(self):
         # returns g_utf8_strlen() in out argument
diff --git a/tests/test_gi.py b/tests/test_gi.py
index 7eb9c99..0890126 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -871,8 +871,7 @@ class TestFilename(unittest.TestCase):
         wd = self.workdir
         wdb = os.fsencode(wd) if PY3 else wd
 
-        paths = [(wdb, b"foo-1"), (wd, u"foo-2"), (wd, u"öäü-3"),
-                 (wdb, b"\xff\xfe-5")]
+        paths = [(wdb, b"foo-1"), (wd, u"foo-2"), (wd, u"öäü-3")]
         if PY3:
             try:
                 paths.append((wd, os.fsdecode(b"\xff\xfe-4")))
@@ -880,6 +879,9 @@ class TestFilename(unittest.TestCase):
                 # depends on the code page
                 pass
 
+        if os.name != "nt":
+            paths.append((wdb, b"\xff\xfe-5"))
+
         def valid_path(p):
             try:
                 os.path.exists(p)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]