Debian Codegraph @

gi/overrides/GIMarshallingTests.py

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