[tracker] functional-tests: Decode query results as UTF-8 in the correct way



commit a4308c5d169e76e6a977c549757201f72bbb0f3f
Author: Sam Thursfield <sam afuera me uk>
Date:   Mon Jun 13 21:59:10 2016 +0100

    functional-tests: Decode query results as UTF-8 in the correct way
    
    Previously the code would try to cast a 'str' instance to 'unicode',
    which fails because it assumes the 'str' instance is valid ASCII (i.e.
    all characters are in the range 0-127).
    
    This fixes 2 test case failures that looked like this:
    
        UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)

 tests/functional-tests/16-collation.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/tests/functional-tests/16-collation.py b/tests/functional-tests/16-collation.py
index 8bab53a..1d2dff2 100755
--- a/tests/functional-tests/16-collation.py
+++ b/tests/functional-tests/16-collation.py
@@ -64,7 +64,7 @@ class TrackerStoreCollationTests (CommonTrackerStoreTest):
         }
          """ % (uri, text))
 
-    def __get_text_sorted_by_collation (self):
+    def get_text_sorted_by_collation (self):
         return self.tracker.query ("""
          SELECT ?title WHERE {
             ?u a nie:InformationElement ;
@@ -78,9 +78,9 @@ class TrackerStoreCollationTests (CommonTrackerStoreTest):
         for i in input_list:
             self.__insert_text (i)
 
-        results = [unicode(r[0]) for r in self.__get_text_sorted_by_collation ()]
+        results = [r[0].decode('utf-8') for r in self.get_text_sorted_by_collation ()]
         self.assertEquals (len (results), len (expected_list))
-        
+
         for r in range (0, len (results)):
             self.assertEquals (results[r], expected_list [r],
                                """Error:


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