MCPcopy Create free account
hub / github.com/enthought/comtypes / MyServer

Class MyServer

comtypes/test/test_server.py:122–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120
121
122class MyServer(comtypes.CoClass, ConnectableObjectMixin):
123 _reg_typelib_ = ("{f4f74946-4546-44bd-a073-9ea6f9fe78cb}", 0, 0)
124 _reg_clsid_ = comtypes.GUID("{fa9de8f4-20de-45fc-b079-648572428817}")
125
126 ################
127 # definition
128 itf.add(
129 """[id(100), propget] HRESULT Name([out, retval] BSTR *pname);
130 [id(100), propput] HRESULT Name([in] BSTR name);"""
131 )
132 # implementation
133 Name = "foo"
134
135 # test
136 def test_Name(self):
137 p = wrap(self.create())
138 self.assertEqual((p.Name, p.name, p.nAME), ("foo",) * 3)
139 p.NAME = "spam"
140 self.assertEqual((p.Name, p.name, p.nAME), ("spam",) * 3)
141
142 ################
143 # definition
144 itf.add(
145 "[id(101)] HRESULT MixedInOut([in] int a, [out] int *b, [in] int c, [out] int *d);"
146 )
147
148 # implementation
149 def MixedInOut(self, a, c):
150 return a + 1, c + 1
151
152 # test
153 def test_MixedInOut(self):
154 p = wrap(self.create())
155 self.assertEqual(p.MixedInOut(1, 2), (2, 3))
156
157 ################
158 # definition
159 itf.add("[id(102)] HRESULT MultiInOutArgs([in, out] int *pa, [in, out] int *pb);")
160
161 # implementation
162 def MultiInOutArgs(self, pa, pb):
163 return pa[0] * 3, pb[0] * 4
164
165 # test
166 def test_MultiInOutArgs(self):
167 p = wrap(self.create())
168 self.assertEqual(p.MultiInOutArgs(1, 2), (3, 8))
169
170 ################
171 # definition
172 itf.add("HRESULT MultiInOutArgs2([in, out] int *pa, [out] int *pb);")
173 ## # implementation
174 ## def MultiInOutArgs2(self, pa):
175 ## return pa[0] * 3, pa[0] * 4
176 ## # test
177 ## def test_MultiInOutArgs2(self):
178 ## p = wrap(self.create())
179 ## self.assertEqual(p.MultiInOutArgs2(42), (126, 168))

Callers 1

createMethod · 0.85

Calls 1

addMethod · 0.45

Tested by 1

createMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…