[pygobject] Test flags and enums in GHash values
- From: Martin Pitt <martinpitt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Test flags and enums in GHash values
- Date: Wed, 25 Apr 2012 07:18:42 +0000 (UTC)
commit 3090cc70a7ce8df38dd6cf6c17350417a7367c0b
Author: Martin Pitt <martinpitt gnome org>
Date: Tue Apr 24 13:24:00 2012 +0200
Test flags and enums in GHash values
https://bugzilla.gnome.org/show_bug.cgi?id=637466
tests/test_everything.py | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/tests/test_everything.py b/tests/test_everything.py
index 6a6d479..563936b 100644
--- a/tests/test_everything.py
+++ b/tests/test_everything.py
@@ -175,18 +175,24 @@ class TestEverything(unittest.TestCase):
self.assertEqual(result['boolean'], True)
self.assertEqual(result['string'], 'some text')
self.assertEqual(result['strings'], ['first', 'second', 'third'])
+ self.assertEqual(result['flags'], Everything.TestFlags.FLAG1 | Everything.TestFlags.FLAG3)
+ self.assertEqual(result['enum'], Everything.TestEnum.VALUE2)
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
+ # 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_from_name('GStrv')
- data = {'integer': 12, 'boolean': True, 'string': 'some text',
- 'strings': GStrv(['first', 'second', 'third'])}
+ data = {'integer': 12,
+ 'boolean': True,
+ 'string': 'some text',
+ 'strings': GStrv(['first', 'second', 'third']),
+ 'flags': Everything.TestFlags.FLAG1 | Everything.TestFlags.FLAG3,
+ 'enum': Everything.TestEnum.VALUE2,
+ }
Everything.test_ghash_gvalue_in(data)
data = None
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]