Skip to content

Conversation

@junkmd
Copy link
Collaborator

@junkmd junkmd commented Dec 17, 2025

This PR builds upon the recent fix for TYPE_E_ELEMENTNOTFOUND by adding more comprehensive tests for ITypeInfo::GetRefTypeOfImplType and improving the overall quality of the test_typeinfo.py module.

Key Changes:

  • Expanded Test Coverage for GetRefTypeOfImplType:

    • Adds new tests for pure dispatch, custom, and dual interfaces to verify the behavior of GetRefTypeOfImplType(-1).
    • Asserts that TYPE_E_ELEMENTNOTFOUND is correctly raised for non-dual interfaces.
    • Validates the TYPEFLAG_FDUAL flag for dual interfaces.
  • Refactoring test_typeinfo.py:

    • Standardizes imports for hresult and COMError for better consistency.
    • Uses fully qualified names for typeinfo constants (e.g., typeinfo.TKIND_DISPATCH) to improve clarity.
  • Documentation:

    • Adds a code comment in tlbparser.py with a link to the official Microsoft documentation for GetRefTypeOfImplType.

This test verifies the behavior of `ITypeInfo.GetRefTypeOfImplType`
when called on a pure dispatch interface.
It asserts that a `COMError` with `TYPE_E_ELEMENTNOTFOUND` is raised,
which also serves as further validation for the recently corrected
HRESULT constant.
This adds another test for `ITypeInfo.GetRefTypeOfImplType`,
this time using a custom interface.

This expands test coverage and further validates that `COMError`
with `TYPE_E_ELEMENTNOTFOUND` is correctly raised for invalid calls.
… assertions.

Replaced direct imports of `TKIND_DISPATCH` and `TKIND_INTERFACE` with
qualified references (e.g., `typeinfo.TKIND_DISPATCH`) for consistency
within `test_typeinfo.py`.

Additionally, added assertions for `TYPEFLAG_FDUAL` in the tests for
pure dispatch and dual interfaces to more thoroughly verify interface
flags, especially for dual interfaces.
The `comtypes.hresult` import was replaced with a direct import
from `comtypes`, and usages were updated accordingly. This change
improves consistency with other imports in the module.
To align with internal conventions, the import for `COMError`
has been changed from `comtypes` to the more direct `_ctypes` module.
@junkmd junkmd added this to the 1.4.15 milestone Dec 17, 2025
@codecov
Copy link

codecov bot commented Dec 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.76%. Comparing base (bd1ed82) to head (d1c6c45).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #884      +/-   ##
==========================================
+ Coverage   84.72%   84.76%   +0.04%     
==========================================
  Files         125      125              
  Lines       11554    11587      +33     
==========================================
+ Hits         9789     9822      +33     
  Misses       1765     1765              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@junkmd junkmd merged commit b823fc6 into enthought:main Dec 17, 2025
99 of 101 checks passed
@junkmd junkmd deleted the test_typeinfo_interfaces branch December 17, 2025 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant