summaryrefslogtreecommitdiff
path: root/tests/test_gi.py
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2017-07-12 08:46:44 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2017-07-12 08:46:48 +0900
commit6db7944f8363094c12cbd3fe2daf8a887fda86b2 (patch)
tree04471661319da32fb9915d94ba75adcd125bdc22 /tests/test_gi.py
parentd71148e4448b78edde9dd063d65c00a13ed27cef (diff)
downloadpygobject2-6db7944f8363094c12cbd3fe2daf8a887fda86b2.tar.gz
pygobject2-6db7944f8363094c12cbd3fe2daf8a887fda86b2.tar.bz2
pygobject2-6db7944f8363094c12cbd3fe2daf8a887fda86b2.zip
Imported Upstream version 3.3.3.1
Change-Id: I57c64216ccaba663cfb48f7e060e4e8bb0961964 Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'tests/test_gi.py')
-rw-r--r--tests/test_gi.py39
1 files changed, 31 insertions, 8 deletions
diff --git a/tests/test_gi.py b/tests/test_gi.py
index 50b5a25..ce988c0 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -1012,16 +1012,19 @@ class TestGHashTable(unittest.TestCase):
self.assertEqual({'-1': '1', '0': '0', '1': '-1', '2': '-2'}, GIMarshallingTests.ghashtable_utf8_full_out())
def test_ghashtable_utf8_none_inout(self):
+ i = {'-1': '1', '0': '0', '1': '-1', '2': '-2'}
self.assertEqual({'-1': '1', '0': '0', '1': '1'},
- GIMarshallingTests.ghashtable_utf8_none_inout({'-1': '1', '0': '0', '1': '-1', '2': '-2'}))
+ GIMarshallingTests.ghashtable_utf8_none_inout(i))
def test_ghashtable_utf8_container_inout(self):
+ i = {'-1': '1', '0': '0', '1': '-1', '2': '-2'}
self.assertEqual({'-1': '1', '0': '0', '1': '1'},
- GIMarshallingTests.ghashtable_utf8_container_inout({'-1': '1', '0': '0', '1': '-1', '2': '-2'}))
+ GIMarshallingTests.ghashtable_utf8_container_inout(i))
def test_ghashtable_utf8_full_inout(self):
+ i = {'-1': '1', '0': '0', '1': '-1', '2': '-2'}
self.assertEqual({'-1': '1', '0': '0', '1': '1'},
- GIMarshallingTests.ghashtable_utf8_full_inout({'-1': '1', '0': '0', '1': '-1', '2': '-2'}))
+ GIMarshallingTests.ghashtable_utf8_full_inout(i))
class TestGValue(unittest.TestCase):
@@ -1088,9 +1091,9 @@ class TestEnum(unittest.TestCase):
Run test under a locale which defines toupper('a') == 'a'
'''
cls.locale_dir = tempfile.mkdtemp()
- subprocess.check_call(['localedef', '-i',
- os.path.join(os.path.dirname(os.path.realpath(__file__)), 'te_ST@nouppera'),
- '-c', '-f', 'UTF-8', os.path.join(cls.locale_dir, 'te_ST.UTF-8@nouppera')])
+ src = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'te_ST@nouppera')
+ dest = os.path.join(cls.locale_dir, 'te_ST.UTF-8@nouppera')
+ subprocess.check_call(['localedef', '-i', src, '-c', '-f', 'UTF-8', dest])
os.environ['LOCPATH'] = cls.locale_dir
locale.setlocale(locale.LC_ALL, 'te_ST.UTF-8@nouppera')
@@ -1767,10 +1770,10 @@ class TestPythonGObject(unittest.TestCase):
_object = SubObject()
_object.call_vfunc_with_callback()
- self.assertTrue(_object.worked == True)
+ self.assertTrue(_object.worked)
_object.worked = False
_object.call_vfunc_with_callback()
- self.assertTrue(_object.worked == True)
+ self.assertTrue(_object.worked)
class TestMultiOutputArgs(unittest.TestCase):
@@ -2209,3 +2212,23 @@ class TestPropertiesObject(unittest.TestCase):
obj = GIMarshallingTests.PropertiesObject(some_boxed_struct=struct1)
self.assertEqual(obj.props.some_boxed_struct.long_, 1)
+
+
+class TestKeywords(unittest.TestCase):
+ def test_method(self):
+ # g_variant_print()
+ v = GLib.Variant('i', 1)
+ self.assertEqual(v.print_(False), '1')
+
+ def test_function(self):
+ # g_thread_yield()
+ self.assertEqual(GLib.Thread.yield_(), None)
+
+ def test_struct_method(self):
+ # g_timer_continue()
+ # we cannot currently instantiate GLib.Timer objects, so just ensure
+ # the method exists
+ self.assertTrue(callable(GLib.Timer.continue_))
+
+ def test_uppercase(self):
+ self.assertEqual(GLib.IOCondition.IN.value_nicks, ['in'])