Skip to content

Commit a4015d3

Browse files
authored
Add Test_Vtbl to test_comobject.py. (#831)
1 parent ea0ed7b commit a4015d3

2 files changed

Lines changed: 17 additions & 3 deletions

File tree

comtypes/hints.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ else:
1616
if sys.version_info >= (3, 10):
1717
from typing import Concatenate, ParamSpec, TypeAlias
1818
from typing import TypeGuard as TypeGuard
19-
from typing import Unpack as Unpack
2019
else:
2120
from typing_extensions import Concatenate, ParamSpec, TypeAlias
2221
from typing_extensions import TypeGuard as TypeGuard
23-
from typing_extensions import Unpack as Unpack
2422
if sys.version_info >= (3, 11):
2523
from typing import Self as Self
24+
from typing import Unpack as Unpack
2625
else:
2726
from typing_extensions import Self as Self
27+
from typing import Unpack as Unpack
2828

2929
import comtypes
3030
from comtypes import IUnknown as IUnknown, COMObject as COMObject, GUID as GUID

comtypes/test/test_comobject.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from unittest import mock
55

66
import comtypes.client
7-
from comtypes import CLSCTX_SERVER, COMObject, IUnknown, hresult
7+
from comtypes import CLSCTX_SERVER, COMObject, IPersist, IUnknown, hresult
88
from comtypes._post_coinit.misc import _CoCreateInstance
99
from comtypes.automation import IDispatch
1010
from comtypes.typeinfo import GUIDKIND_DEFAULT_SOURCE_DISP_IID
@@ -143,3 +143,17 @@ def test(self):
143143
uiac.CUIAutomation().IPersist_GetClassID(),
144144
uiac.CUIAutomation._reg_clsid_,
145145
)
146+
147+
148+
class Test_Vtbl(ut.TestCase):
149+
def test_com_pointers(self):
150+
stdpic = stdole.StdPicture()
151+
cuia = uiac.CUIAutomation()
152+
self.assertIs(
153+
type(stdpic._com_pointers_[IPersist._iid_]),
154+
type(cuia._com_pointers_[IPersist._iid_]),
155+
)
156+
self.assertIn(IDispatch._iid_, stdpic._com_pointers_)
157+
self.assertNotIn(IDispatch._iid_, cuia._com_pointers_)
158+
self.assertIn(stdole.IPictureDisp._iid_, stdpic._com_pointers_)
159+
self.assertIn(uiac.IUIAutomation._iid_, cuia._com_pointers_)

0 commit comments

Comments
 (0)