| 1 |
import unittest |
| 2 |
|
| 3 |
from gi.repository import GObject |
| 4 |
|
| 5 |
import testhelper |
| 6 |
|
| 7 |
|
| 8 |
TestInterface = GObject.GType.from_name("TestInterface") |
| 9 |
|
| 10 |
|
| 11 |
class TestUnknown(unittest.TestCase): |
| 12 |
def test_unknown_interface(self): |
| 13 |
obj = testhelper.get_unknown() |
| 14 |
TestUnknownGType = GObject.GType.from_name("TestUnknown") |
| 15 |
TestUnknown = GObject.new(TestUnknownGType).__class__ |
| 16 |
assert isinstance(obj, testhelper.Interface) |
| 17 |
assert isinstance(obj, TestUnknown) |
| 18 |
|
| 19 |
def test_property(self): |
| 20 |
obj = testhelper.get_unknown() |
| 21 |
self.assertEqual(obj.get_property("some-property"), None) |
| 22 |
obj.set_property("some-property", "foo") |
| 23 |
|
| 24 |
def test_unknown_property(self): |
| 25 |
obj = testhelper.get_unknown() |
| 26 |
self.assertRaises(TypeError, obj.get_property, "unknown") |
| 27 |
self.assertRaises(TypeError, obj.set_property, "unknown", "1") |