e9f8e33ec3b633a216d7a6d2920f64e260c5b519
[platform/upstream/pygobject2.git] / gi / overrides / GIMarshallingTests.py
1 # -*- Mode: Python; py-indent-offset: 4 -*-
2 # vim: tabstop=4 shiftwidth=4 expandtab
3 #
4 # Copyright (C) 2010 Simon van der Linden <svdlinden@src.gnome.org>
5 #
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
10 #
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 # Lesser General Public License for more details.
15 #
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
19 # USA
20
21 from ..overrides import override
22 from ..module import get_introspection_module
23
24 GIMarshallingTests = get_introspection_module('GIMarshallingTests')
25
26 __all__ = []
27
28 OVERRIDES_CONSTANT = 7
29 __all__.append('OVERRIDES_CONSTANT')
30
31
32 class OverridesStruct(GIMarshallingTests.OverridesStruct):
33
34     def __new__(cls, long_):
35         return GIMarshallingTests.OverridesStruct.__new__(cls)
36
37     def __init__(self, long_):
38         GIMarshallingTests.OverridesStruct.__init__(self)
39         self.long_ = long_
40
41     def method(self):
42         return GIMarshallingTests.OverridesStruct.method(self) / 7
43
44
45 OverridesStruct = override(OverridesStruct)
46 __all__.append('OverridesStruct')
47
48
49 class OverridesObject(GIMarshallingTests.OverridesObject):
50
51     def __new__(cls, long_):
52         return GIMarshallingTests.OverridesObject.__new__(cls)
53
54     def __init__(self, long_):
55         GIMarshallingTests.OverridesObject.__init__(self)
56         # FIXME: doesn't work yet
57         # self.long_ = long_
58
59     @classmethod
60     def new(cls, long_):
61         self = GIMarshallingTests.OverridesObject.new()
62         # FIXME: doesn't work yet
63         # self.long_ = long_
64         return self
65
66     def method(self):
67         """Overridden doc string."""
68         return GIMarshallingTests.OverridesObject.method(self) / 7
69
70
71 OverridesObject = override(OverridesObject)
72 __all__.append('OverridesObject')