comtypes icon indicating copy to clipboard operation
comtypes copied to clipboard

fix `client.GetClassObject` type annotations and add tests

Open junkmd opened this issue 2 years ago • 1 comments
trafficstars

Remaining tasks for #456.

https://github.com/enthought/comtypes/blob/18dc2cc0175ee3da76ca2e2766157a4a0a897884/comtypes/client/init.py#L200-L222

  • remove if TYPE_CHECKING bridges, like #453.
  • change type hints from comment annotations to inline annotations, like #453.
  • add TestCase in test/test_client.py that call client.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.mock whenever possible.
  • make sure that if passing Type[_T_IUnknown] for interface, the return value will be analyzed as _T_IUnknown by 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.

junkmd avatar Jan 07 '23 08:01 junkmd

This is related to #453.

Since comtypes.CoGetClassObject is also untested, we should avoid a situation where no tests without using unittest.mock.patch.

junkmd avatar Jan 07 '23 08:01 junkmd