summaryrefslogtreecommitdiff
path: root/tests/test_internal_api.py
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2017-07-12 08:46:30 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2017-07-12 08:46:33 +0900
commitdca4e6423c560689ee831785473ad3ab48e7548a (patch)
tree048ddb6edb0826be8ff180c027d45acb6dac67db /tests/test_internal_api.py
parent392945d666d2cfb31a844826a72b1eb65a52546f (diff)
downloadpygobject2-dca4e6423c560689ee831785473ad3ab48e7548a.tar.gz
pygobject2-dca4e6423c560689ee831785473ad3ab48e7548a.tar.bz2
pygobject2-dca4e6423c560689ee831785473ad3ab48e7548a.zip
Imported Upstream version 3.3.1
Change-Id: I7e59d7cf82217b545ec40115122a83ebf79763cb Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'tests/test_internal_api.py')
-rw-r--r--tests/test_internal_api.py73
1 files changed, 0 insertions, 73 deletions
diff --git a/tests/test_internal_api.py b/tests/test_internal_api.py
deleted file mode 100644
index eb66fdd..0000000
--- a/tests/test_internal_api.py
+++ /dev/null
@@ -1,73 +0,0 @@
-# -*- Mode: Python -*-
-
-import unittest
-
-from gi.repository import GLib, GObject
-
-import testhelper
-import testmodule
-
-
-class TestObject(unittest.TestCase):
- def test_create_ctor(self):
- o = testmodule.PyGObject()
- self.assertTrue(isinstance(o, GObject.Object))
- self.assertTrue(isinstance(o, testmodule.PyGObject))
-
- # has expected property
- self.assertEqual(o.props.label, 'hello')
- o.props.label = 'goodbye'
- self.assertEqual(o.props.label, 'goodbye')
- self.assertRaises(AttributeError, getattr, o.props, 'nosuchprop')
-
- def test_pyobject_new_test_type(self):
- o = testhelper.create_test_type()
- self.assertTrue(isinstance(o, testmodule.PyGObject))
-
- # has expected property
- self.assertEqual(o.props.label, 'hello')
- o.props.label = 'goodbye'
- self.assertEqual(o.props.label, 'goodbye')
- self.assertRaises(AttributeError, getattr, o.props, 'nosuchprop')
-
- def test_new_refcount(self):
- # TODO: justify why this should be 2
- self.assertEqual(testhelper.test_g_object_new(), 2)
-
-
-class TestGValueConversion(unittest.TestCase):
- def test_int(self):
- self.assertEqual(testhelper.test_value(0), 0)
- self.assertEqual(testhelper.test_value(5), 5)
- self.assertEqual(testhelper.test_value(-5), -5)
- self.assertEqual(testhelper.test_value(GLib.MAXINT32), GLib.MAXINT32)
- self.assertEqual(testhelper.test_value(GLib.MININT32), GLib.MININT32)
-
- def test_str(self):
- self.assertEqual(testhelper.test_value('hello'), 'hello')
-
- def test_int_array(self):
- self.assertEqual(testhelper.test_value_array([]), [])
- self.assertEqual(testhelper.test_value_array([0]), [0])
- ar = list(range(100))
- self.assertEqual(testhelper.test_value_array(ar), ar)
-
- def test_str_array(self):
- self.assertEqual(testhelper.test_value_array([]), [])
- self.assertEqual(testhelper.test_value_array(['a']), ['a'])
- ar = ('aa ' * 1000).split()
- self.assertEqual(testhelper.test_value_array(ar), ar)
-
-
-class TestErrors(unittest.TestCase):
- def test_gerror(self):
- callable_ = lambda: GLib.file_get_contents('/nonexisting ')
- self.assertRaises(GLib.GError, testhelper.test_gerror_exception, callable_)
-
- def test_no_gerror(self):
- callable_ = lambda: GLib.file_get_contents(__file__)
- self.assertEqual(testhelper.test_gerror_exception(callable_), None)
-
-
-if __name__ == '__main__':
- unittest.main()