[pygobject] tests: Change GHashTable<string, GValue> marshaling test to use GValue



commit f86701b15ee04c717d9c6bf688101606165e4f83
Author: Simon Feltman <sfeltman src gnome org>
Date:   Wed Jul 24 19:36:28 2013 -0700

    tests: Change GHashTable<string,GValue> marshaling test to use GValue
    
    Add test to explicitly use a boxed GStrv GValue in addition to a
    Python list sub-class.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=666636

 tests/test_everything.py |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/tests/test_everything.py b/tests/test_everything.py
index 87b3d2b..0e593cc 100644
--- a/tests/test_everything.py
+++ b/tests/test_everything.py
@@ -480,17 +480,15 @@ class TestEverything(unittest.TestCase):
         self.assertEqual(Everything.test_ghash_nested_everything_return2(), {})
 
     def test_hash_in(self):
-        # specifying a simple string array for "strings" does not work due to
-        # https://bugzilla.gnome.org/show_bug.cgi?id=666636
-        # workaround by explicitly building a GStrv object
-        class GStrv(list):
-            __gtype__ = GObject.TYPE_STRV
-
         expected = {'foo': 'bar', 'baz': 'bat', 'qux': 'quux'}
 
         Everything.test_ghash_nothing_in(expected)
         Everything.test_ghash_nothing_in2(expected)
 
+    def test_hash_in_with_typed_strv(self):
+        class GStrv(list):
+            __gtype__ = GObject.TYPE_STRV
+
         data = {'integer': 12,
                 'boolean': True,
                 'string': 'some text',
@@ -501,6 +499,17 @@ class TestEverything(unittest.TestCase):
         Everything.test_ghash_gvalue_in(data)
         data = None
 
+    def test_hash_in_with_gvalue_strv(self):
+        data = {'integer': 12,
+                'boolean': True,
+                'string': 'some text',
+                'strings': GObject.Value(GObject.TYPE_STRV, ['first', 'second', 'third']),
+                'flags': Everything.TestFlags.FLAG1 | Everything.TestFlags.FLAG3,
+                'enum': Everything.TestEnum.VALUE2,
+               }
+        Everything.test_ghash_gvalue_in(data)
+        data = None
+
     def test_struct_gpointer(self):
         glist = GLib.List()
         raw = RawGList.from_wrapped(glist)


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