Пример #1
0
    def test_atk(self):
        repo = Repository("Atk", "1.0")
        Atk = repo.import_module()

        c = Constant.from_object(repo, "", "FOO", Atk.Document.__gtype__)
        self.assertEqual(str(c.value), "<GType AtkDocument>")

        klass = Class.from_object(repo, Atk.Document)
        method = find(klass.methods, "get_attributes")
        self.assertEqual(method.info.version_added, "1.12")

        method = find(klass.methods, "get_attribute_value")
        self.assertEqual(method.info.version_added, "1.12")

        klass = Class.from_object(repo, Atk.Hyperlink)

        method = find(klass.methods, "is_selected_link")
        self.assertTrue(method.info.deprecated)
        self.assertEqual(method.info.version_added, "1.4")
        self.assertEqual(method.info.version_deprecated, "1.8")
        self.assertTrue(method.info.deprecation_desc, "1.8")

        klass = Flags.from_object(repo, Atk.Role)
        info = find(klass.values, "APPLICATION").info
        self.assertEqual(info.version_added, "1.1.4")
Пример #2
0
    def test_atk(self):
        repo = Repository("Atk", "1.0")
        Atk = repo.import_module()

        c = Constant.from_object(repo, "", "FOO", Atk.Document.__gtype__)
        self.assertEqual(str(c.value), "<GType AtkDocument>")

        klass = Class.from_object(repo, Atk.Document)
        method = find(klass.methods, "get_attributes")
        self.assertEqual(method.info.version_added, "1.12")

        method = find(klass.methods, "get_attribute_value")
        self.assertEqual(method.info.version_added, "1.12")

        klass = Class.from_object(repo, Atk.Hyperlink)

        method = find(klass.methods, "is_selected_link")
        self.assertTrue(method.info.deprecated)
        self.assertEqual(method.info.version_added, "1.4")
        self.assertEqual(method.info.version_deprecated, "1.8")
        self.assertTrue(method.info.deprecation_desc, "1.8")

        klass = Flags.from_object(repo, Atk.Role)
        info = find(klass.values, "APPLICATION").info
        self.assertEqual(info.version_added, "1.1.4")
Пример #3
0
    def test_gtk(self):
        repo = Repository("Gtk", "3.0")
        Gtk = repo.import_module()

        klass = Class.from_object(repo, Gtk.TreeModel)
        vfunc = find(klass.vfuncs, "do_get_iter")
        self.assertTrue(vfunc.info.desc)

        Class.from_object(repo, Gtk.Button)
        Class.from_object(repo, Gtk.Paned)
        Class.from_object(repo, Gtk.ActionBar)

        klass = Class.from_object(repo, Gtk.TextView)
        self.assertTrue(klass.image_path)

        klass = Class.from_object(repo, Gtk.Widget)
        translate_coordinates = find(klass.methods, "translate_coordinates")
        # make sure we replace src_widget with self
        self.assertTrue("src_widget" not in translate_coordinates.info.desc)

        mod = repo.parse()
        find(mod.class_structures, "WidgetClass")
        find(mod.structures, "TableChild")
        self.assertRaises(
            LookupError, find, mod.class_structures, "TableChild")
        self.assertRaises(
            LookupError, find, mod.structures, "WidgetClass")
Пример #4
0
    def test_gtk(self):
        repo = Repository("Gtk", "3.0")
        Gtk = repo.import_module()

        klass = Class.from_object(repo, Gtk.TreeModel)
        vfunc = find(klass.vfuncs, "do_get_iter")
        self.assertTrue(vfunc.info.desc)

        Class.from_object(repo, Gtk.Button)
        Class.from_object(repo, Gtk.Paned)
        Class.from_object(repo, Gtk.ActionBar)

        klass = Class.from_object(repo, Gtk.TextView)
        self.assertTrue(klass.image_path)

        klass = Class.from_object(repo, Gtk.Widget)
        translate_coordinates = find(klass.methods, "translate_coordinates")
        # make sure we replace src_widget with self
        self.assertTrue("src_widget" not in translate_coordinates.info.desc)

        mod = repo.parse()
        find(mod.class_structures, "WidgetClass")
        find(mod.structures, "TableChild")
        self.assertRaises(LookupError, find, mod.class_structures,
                          "TableChild")
        self.assertRaises(LookupError, find, mod.structures, "WidgetClass")
Пример #5
0
 def test_method_inheritance(self):
     repo = Repository("Atk", "1.0")
     Atk = repo.import_module()
     klass = Class.from_object(repo, Atk.Plug)
     self.assertEqual(klass.methods_inherited, [('Atk.Object', 23),
                                                ('GObject.Object', 33),
                                                ('Atk.Component', 13)])
Пример #6
0
 def test_method_inheritance(self):
     repo = Repository("Atk", "1.0")
     Atk = repo.import_module()
     klass = Class.from_object(repo, Atk.Plug)
     self.assertEqual(
         [x[0] for x in klass.methods_inherited],
         ['Atk.Object', 'GObject.Object', 'Atk.Component']
     )
Пример #7
0
    def test_gio(self):
        repo = Repository("Gio", "2.0")
        Gio = repo.import_module()

        klass = Class.from_object(repo, Gio.Application)
        method = find(klass.methods, "activate")
        signal = find(klass.signals, "activate")

        self.assertTrue(method.info.desc)
        self.assertTrue(signal.info.desc)
        self.assertNotEqual(method.info.desc, signal.info.desc)

        signal = find(klass.signals, "command_line")
        self.assertTrue(":param command_line:" in signal.signature_desc)

        klass = Class.from_object(repo, Gio.File)
        method = find(klass.methods, "load_contents_finish")
        self.assertTrue(":returns:" in method.signature_desc)
Пример #8
0
    def test_gio(self):
        repo = Repository("Gio", "2.0")
        Gio = repo.import_module()

        klass = Class.from_object(repo, Gio.Application)
        method = find(klass.methods, "activate")
        signal = find(klass.signals, "activate")

        self.assertTrue(method.info.desc)
        self.assertTrue(signal.info.desc)
        self.assertNotEqual(method.info.desc, signal.info.desc)

        signal = find(klass.signals, "command_line")
        self.assertTrue(":param command_line:" in signal.signature_desc)

        klass = Class.from_object(repo, Gio.File)
        method = find(klass.methods, "load_contents_finish")
        self.assertTrue(":returns:" in method.signature_desc)
Пример #9
0
 def test_method_inheritance(self):
     repo = Repository("Atk", "1.0")
     Atk = repo.import_module()
     klass = Class.from_object(repo, Atk.Plug)
     self.assertEqual(
         klass.methods_inherited,
         [('Atk.Object', 23),
          ('GObject.Object', 33),
          ('Atk.Component', 13)])
Пример #10
0
    def test_gtk_overrides(self):
        repo = Repository("Gtk", "3.0")
        Gtk = repo.import_module()

        PyClass.from_object(repo, Gtk.TreeModelRow)
        PyClass.from_object(repo, Gtk.TreeModelRowIter)

        func = Function.from_object("Gtk.Container", "child_get", Gtk.Container.child_get, repo, Gtk.Container)
        self.assertEqual(func.info.desc, "Returns a list of child property values for the given names.")
        self.assertEqual(func.signature, "(child, *prop_names)")

        func = Function.from_object("Gtk", "stock_lookup", Gtk.stock_lookup, repo, Gtk)
        self.assertEqual(func.signature, "(stock_id)")

        klass = Class.from_object(repo, Gtk.Widget)
        self.assertEqual(
            klass.subclasses.count("Gtk.Container"), 1)
Пример #11
0
    def test_gtk(self):
        repo = Repository("Gtk", "3.0")
        mod = repo.parse()
        Gtk = repo.import_module()

        klass = Class.from_object(repo, Gtk.TreeModel)
        vfunc = find(klass.vfuncs, "do_get_iter")
        self.assertTrue(vfunc.info.desc)

        Class.from_object(repo, Gtk.Button)
        Class.from_object(repo, Gtk.Paned)
        Class.from_object(repo, Gtk.ActionBar)

        klass = Class.from_object(repo, Gtk.TextView)
        self.assertTrue(klass.image_path)

        find(mod.class_structures, "WidgetClass")
        find(mod.structures, "TableChild")
        self.assertRaises(LookupError, find, mod.class_structures,
                          "TableChild")
        self.assertRaises(LookupError, find, mod.structures, "WidgetClass")
Пример #12
0
    def test_gtk(self):
        repo = Repository("Gtk", "3.0")
        mod = repo.parse()
        Gtk = repo.import_module()

        klass = Class.from_object(repo, Gtk.TreeModel)
        vfunc = find(klass.vfuncs, "do_get_iter")
        self.assertTrue(vfunc.info.desc)

        Class.from_object(repo, Gtk.Button)
        Class.from_object(repo, Gtk.Paned)
        Class.from_object(repo, Gtk.ActionBar)

        klass = Class.from_object(repo, Gtk.TextView)
        self.assertTrue(klass.image_path)

        find(mod.class_structures, "WidgetClass")
        find(mod.structures, "TableChild")
        self.assertRaises(
            LookupError, find, mod.class_structures, "TableChild")
        self.assertRaises(
            LookupError, find, mod.structures, "WidgetClass")
Пример #13
0
    def test_gtk_overrides(self):
        repo = Repository("Gtk", "3.0")
        Gtk = repo.import_module()

        PyClass.from_object(repo, Gtk.TreeModelRow)
        PyClass.from_object(repo, Gtk.TreeModelRowIter)

        func = Function.from_object("Gtk.Container", "child_get",
                                    Gtk.Container.child_get, repo,
                                    Gtk.Container)
        self.assertEqual(
            func.info.desc,
            "Returns a list of child property values for the given names.")
        self.assertEqual(func.signature, "(child, *prop_names)")

        func = Function.from_object("Gtk", "stock_lookup", Gtk.stock_lookup,
                                    repo, Gtk)
        self.assertEqual(func.signature, "(stock_id)")

        klass = Class.from_object(repo, Gtk.Widget)
        self.assertEqual(klass.subclasses.count("Gtk.Container"), 1)
Пример #14
0
    def test_gobject(self):
        repo = Repository("GObject", "2.0")
        GObject = repo.import_module()
        mod = repo.parse()

        self.assertEqual(repo.lookup_py_id_for_type_struct("GObjectClass"),
                         "GObject.Object")

        klass = Class.from_object(repo, GObject.Object)
        method = find(klass.methods, "list_properties")
        self.assertTrue(method.is_static)
        self.assertEqual(method.fullname, "GObject.Object.list_properties")

        klass = find(mod.enums, "GEnum")
        self.assertEqual(klass.base, "GLib.Enum")

        klass = find(mod.flags, "GFlags")
        self.assertEqual(klass.base, "GLib.Flags")

        klass = find(mod.flags, "ParamFlags")
        self.assertEqual(klass.base, "GLib.Flags")
Пример #15
0
    def test_gobject(self):
        repo = Repository("GObject", "2.0")
        GObject = repo.import_module()
        mod = repo.parse()

        self.assertEqual(
            repo.lookup_py_id_for_type_struct("GObjectClass"),
            "GObject.Object")

        klass = Class.from_object(repo, GObject.Object)
        method = find(klass.methods, "list_properties")
        self.assertTrue(method.is_static)
        self.assertEqual(method.fullname, "GObject.Object.list_properties")

        klass = find(mod.enums, "GEnum")
        self.assertEqual(klass.base, "GLib.Enum")

        klass = find(mod.flags, "GFlags")
        self.assertEqual(klass.base, "GLib.Flags")

        klass = find(mod.flags, "ParamFlags")
        self.assertEqual(klass.base, "GLib.Flags")
Пример #16
0
 def test_gudev(self):
     repo = Repository("GUdev", "1.0")
     GUdev = repo.import_module()
     Class.from_object(repo, GUdev.Client)
Пример #17
0
 def test_gudev(self):
     repo = Repository("GUdev", "1.0")
     GUdev = repo.import_module()
     Class.from_object(repo, GUdev.Client)
Пример #18
0
 def test_method_inheritance(self):
     repo = Repository("Atk", "1.0")
     Atk = repo.import_module()
     klass = Class.from_object(repo, Atk.Plug)
     self.assertEqual([x[0] for x in klass.methods_inherited],
                      ['Atk.Object', 'GObject.Object', 'Atk.Component'])