[pygobject] [gi] Added additional test case for GVariant handling



commit 070f6688be4afb926656038dcceac4c8b8ed97c7
Author: Sebastian Pölsterl <sebp k-d-w org>
Date:   Fri Apr 15 15:58:31 2011 +0200

    [gi] Added additional test case for GVariant handling

 tests/test_overrides.py |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/tests/test_overrides.py b/tests/test_overrides.py
index 8e29e1f..ed0b737 100644
--- a/tests/test_overrides.py
+++ b/tests/test_overrides.py
@@ -190,6 +190,21 @@ class TestGLib(unittest.TestCase):
         self.assertEqual(variant.get_type_string(), '(ia{sa{sb}}s)')
         self.assertEqual(variant.unpack(), obj)
 
+        obj = {"frequency": GLib.Variant('t', 738000000),
+            "hierarchy": GLib.Variant('i', 0),
+            "bandwidth": GLib.Variant('x', 8),
+            "code-rate-hp": GLib.Variant('d', 2.0/3.0),
+            "constellation": GLib.Variant('s', "QAM16"),
+            "guard-interval": GLib.Variant('u', 4),}
+        variant = GLib.Variant('a{sv}', obj)
+        self.assertEqual(variant.get_type_string(), 'a{sv}')
+        self.assertEqual(variant.unpack(), {"frequency": 738000000,
+            "hierarchy": 0,
+            "bandwidth": 8,
+            "code-rate-hp": 2.0/3.0,
+            "constellation": "QAM16",
+            "guard-interval": 4})
+
     def test_gvariant_create_errors(self):
         # excess arguments
         self.assertRaises(TypeError, GLib.Variant, 'i', 42, 3)



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