[pygobject] tests: Activate test_hash_in and apply workaround



commit 88d189ec3e3d900a96496a50c1d6e76615b19558
Author: Martin Pitt <martinpitt gnome org>
Date:   Tue Apr 24 13:03:36 2012 +0200

    tests: Activate test_hash_in and apply workaround
    
    Work around pygobject's current inability to produce a GStrv object from a
    string array by explicitly producing a GStrV object, and reactivate test case.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=666636

 tests/test_everything.py |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)
---
diff --git a/tests/test_everything.py b/tests/test_everything.py
index c54542c..6a6d479 100644
--- a/tests/test_everything.py
+++ b/tests/test_everything.py
@@ -174,19 +174,21 @@ class TestEverything(unittest.TestCase):
         self.assertEqual(result['integer'], 12)
         self.assertEqual(result['boolean'], True)
         self.assertEqual(result['string'], 'some text')
-        strings = result['strings']
-        self.assertTrue('first' in strings)
-        self.assertTrue('second' in strings)
-        self.assertTrue('third' in strings)
+        self.assertEqual(result['strings'], ['first', 'second', 'third'])
         result = None
 
-    @unittest.skip('marshalling of GStrv in GValue not working')
-    def test_hash_in_out(self):
-        result = Everything.test_ghash_gvalue_return()
-        # The following line will cause a failure, because we don't support
-        # marshalling GStrv in GValue.
-        Everything.test_ghash_gvalue_in(result)
-        result = None
+    def test_hash_in(self):
+        #data = {'integer': 12, 'boolean': True, 'string': 'some text',
+        #        'strings': ['first', 'second', 'third']}
+        # above does not work due to https://bugzilla.gnome.org/show_bug.cgi?id=666636
+        # so use workaround to explicitly build a GStrV object
+        class GStrv(list):
+            __gtype__ = GObject.type_from_name('GStrv')
+
+        data = {'integer': 12, 'boolean': True, 'string': 'some text',
+                'strings': GStrv(['first', 'second', 'third'])}
+        Everything.test_ghash_gvalue_in(data)
+        data = None
 
     def test_struct_gpointer(self):
         l1 = GLib.List()



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