summaryrefslogtreecommitdiff
path: root/tests/test_unknown.py
blob: 1ed1fb88694ff63542836e71ed7a4f25fb580ca0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# -*- Mode: Python -*-

from __future__ import absolute_import

import unittest

from gi.repository import GObject

import testhelper


TestInterface = GObject.GType.from_name('TestInterface')


class TestUnknown(unittest.TestCase):
    def test_unknown_interface(self):
        obj = testhelper.get_unknown()
        TestUnknownGType = GObject.GType.from_name('TestUnknown')
        TestUnknown = GObject.new(TestUnknownGType).__class__
        assert isinstance(obj, testhelper.Interface)
        assert isinstance(obj, TestUnknown)

    def test_property(self):
        obj = testhelper.get_unknown()
        self.assertEqual(obj.get_property('some-property'), None)
        obj.set_property('some-property', 'foo')

    def test_unknown_property(self):
        obj = testhelper.get_unknown()
        self.assertRaises(TypeError, obj.get_property, 'unknown')
        self.assertRaises(TypeError, obj.set_property, 'unknown', '1')