File: test_unknown.py

package info (click to toggle)
pygobject 3.54.5-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,864 kB
  • sloc: ansic: 40,281; python: 26,363; sh: 477; makefile: 81; xml: 35; cpp: 1
file content (27 lines) | stat: -rw-r--r-- 869 bytes parent folder | download
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
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")