Skip to content

Commit

Permalink
Add unit test for generated IEnum (enthought#468) (enthought#471)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
jonschz and jonschz authored Jan 16, 2023
1 parent 1615af5 commit e1ee6f0
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions comtypes/test/test_ienum.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import contextlib
import unittest as ut

from ctypes import POINTER
from comtypes import GUID
import comtypes.client


class Test_IEnum(ut.TestCase):
def test_ienum(self):
with contextlib.redirect_stdout(None): # supress warnings, see test_client.py
comtypes.client.GetModule("msvidctl.dll")
from comtypes.gen import MSVidCtlLib as vidlib

CLSID_AviSplitter = GUID("{1b544c20-fd0b-11ce-8c63-00aa0044b51e}")

avisplitter = comtypes.client.CreateObject(
CLSID_AviSplitter,
interface=vidlib.IBaseFilter,
)
pinEnum = avisplitter.EnumPins()
self.assertIsInstance(pinEnum, POINTER(vidlib.IEnumPins))
# make sure pinEnum is iterable and non-empty
pins = list(pinEnum)
self.assertGreater(len(pins), 0)


if __name__ == "__main__":
ut.main()

0 comments on commit e1ee6f0

Please sign in to comment.