Skip to content

Commit

Permalink
Removed unused import of 'ctypes.byref'.
Browse files Browse the repository at this point in the history
Added values for the 'answer' and 'needs_clarification' fields of
the 'StructRecordParamTest' structure and included them in the
assertion testing.
  • Loading branch information
geppi committed Jun 28, 2024
1 parent cc9a8c8 commit d0826aa
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion comtypes/test/test_midl_safearray_create.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8

from ctypes import byref, c_int, pointer, POINTER
from ctypes import c_int, pointer, POINTER
import unittest

import comtypes
Expand Down Expand Up @@ -64,7 +64,9 @@ def test_record(self):
*StructRecordParamTest._recordinfo_
)
record = StructRecordParamTest()
record.question = "The meaning of life, the universe and everything?"
record.answer = 42
record.needs_clarification = True
sa_type = comtypes.safearray._midlSAFEARRAY(StructRecordParamTest)
for ptn, sa in [
("with extra", sa_type.create([record], extra=extra)),
Expand All @@ -73,7 +75,12 @@ def test_record(self):
with self.subTest(ptn=ptn):
(unpacked,) = sa.unpack()
self.assertIsInstance(unpacked, StructRecordParamTest)
self.assertEqual(
unpacked.question,
"The meaning of life, the universe and everything?",
)
self.assertEqual(unpacked.answer, 42)
self.assertEqual(unpacked.needs_clarification, True)

def test_ctype(self):
extra = None
Expand Down

0 comments on commit d0826aa

Please sign in to comment.