[pygobject] test_gio: Fix for Python 2



commit 074f10d815453e58f4bee2f440c5db799add3876
Author: Martin Pitt <martinpitt gnome org>
Date:   Mon Jan 14 07:48:31 2013 +0100

    test_gio: Fix for Python 2
    
    Python 2 does not yet take an "encoding" argument for str(), while Python 3
    requires it. Use a less fancy static test string instead.

 tests/test_gio.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/tests/test_gio.py b/tests/test_gio.py
index c13b610..942ee00 100644
--- a/tests/test_gio.py
+++ b/tests/test_gio.py
@@ -133,7 +133,7 @@ class TestGFile(unittest.TestCase):
             pass
 
     def test_replace_contents(self):
-        content = b''.join(bytes(chr(i), 'utf-8') for i in range(128))
+        content = b'hello\0world\x7F!'
         succ, etag = self.file.replace_contents(content, None, False,
                                                 Gio.FileCreateFlags.NONE, None)
         new_succ, new_content, new_etag = self.file.load_contents(None)



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