Skip to content

Commit c4ed5de

Browse files
jonschzjunkmd
authored andcommitted
Add unit test for generated IEnum (enthought#468) (enthought#471)
* unit test for generated IEnum (enthought#468) * change enum_test to a non-empty IEnum * improved checks and clarity * apply requested changes Co-authored-by: jonschz <[email protected]> (cherry picked from commit e1ee6f0)
1 parent 9385467 commit c4ed5de

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

comtypes/test/test_ienum.py

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import contextlib
2+
import unittest as ut
3+
4+
from ctypes import POINTER
5+
from comtypes import GUID
6+
import comtypes.client
7+
8+
9+
class Test_IEnum(ut.TestCase):
10+
def test_ienum(self):
11+
with contextlib.redirect_stdout(None): # supress warnings, see test_client.py
12+
comtypes.client.GetModule("msvidctl.dll")
13+
from comtypes.gen import MSVidCtlLib as vidlib
14+
15+
CLSID_AviSplitter = GUID("{1b544c20-fd0b-11ce-8c63-00aa0044b51e}")
16+
17+
avisplitter = comtypes.client.CreateObject(
18+
CLSID_AviSplitter,
19+
interface=vidlib.IBaseFilter,
20+
)
21+
pinEnum = avisplitter.EnumPins()
22+
self.assertIsInstance(pinEnum, POINTER(vidlib.IEnumPins))
23+
# make sure pinEnum is iterable and non-empty
24+
pins = list(pinEnum)
25+
self.assertGreater(len(pins), 0)
26+
27+
28+
if __name__ == "__main__":
29+
ut.main()

0 commit comments

Comments
 (0)