comtypes
comtypes copied to clipboard
fix `client.GetClassObject` type annotations and add tests
trafficstars
Remaining tasks for #456.
https://github.com/enthought/comtypes/blob/18dc2cc0175ee3da76ca2e2766157a4a0a897884/comtypes/client/init.py#L200-L222
- remove
if TYPE_CHECKINGbridges, like #453. - change type hints from comment annotations to inline annotations, like #453.
- add
TestCaseintest/test_client.pythat callclient.GetClassObject.- At least one of the tests should use a universal COM library such as those found in CI environments. Please do not use
unittest.mockwhenever possible.
- At least one of the tests should use a universal COM library such as those found in CI environments. Please do not use
- make sure that if passing
Type[_T_IUnknown]forinterface, the return value will be analyzed as_T_IUnknownby static type checkers. - Before PR, please format the code by
black(the maximum number of characters per line is 88, which is the default).
I hope someone who actually uses client.GetClassObject will PR along with the introduction of use cases, because I had not use this function.
This is related to #453.
Since comtypes.CoGetClassObject is also untested, we should avoid a situation where no tests without using unittest.mock.patch.