Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
junkmd committed Jun 28, 2024
1 parent 78aad25 commit f992321
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions comtypes/test/test_midl_safearray_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from comtypes.gen.UIAutomationClient import CUIAutomation, IUIAutomation

GetModule("scrrun.dll")
from comtypes.gen.Scripting import Dictionary, IDictionary
from comtypes.gen.Scripting import FileSystemObject, IFileSystem

ComtypesCppTestSrvLib_GUID = "{07D2AEE5-1DF8-4D2C-953A-554ADFD25F99}"

Expand Down Expand Up @@ -44,20 +44,19 @@ def test_iunk(self):
(unpacked,) = sa.unpack()
self.assertIsInstance(unpacked, POINTER(IUIAutomation))

@unittest.skipIf(sys.version_info < (3, 12), "Why?")
# @unittest.skipIf(sys.version_info < (3, 12), "Why?")
def test_idisp(self):
extra = pointer(IDictionary._iid_)
print(IDictionary._iid_)
idic = CreateObject(Dictionary, interface=IDictionary)
idic["foo"] = "bar"
sa_type = comtypes.safearray._midlSAFEARRAY(POINTER(IDictionary))
extra = pointer(IFileSystem._iid_)
print(IFileSystem._iid_)
idisp = CreateObject(FileSystemObject, interface=IFileSystem)
sa_type = comtypes.safearray._midlSAFEARRAY(POINTER(IFileSystem))
for ptn, sa in [
("with extra", sa_type.create([idic], extra=extra)),
("without extra", sa_type.create([idic])),
("with extra", sa_type.create([idisp], extra=extra)),
("without extra", sa_type.create([idisp])),
]:
with self.subTest(ptn=ptn):
(unpacked,) = sa.unpack()
self.assertIsInstance(unpacked, IDictionary)
self.assertIsInstance(unpacked, POINTER(IFileSystem))
self.assertEqual(unpacked["foo"], "bar")

@unittest.skipIf(IMPORT_FAILED, "This depends on the out of process COM-server.")
Expand Down

0 comments on commit f992321

Please sign in to comment.