Skip to content

Conversation

@junkmd
Copy link
Collaborator

@junkmd junkmd commented Feb 10, 2026

Overview

This PR introduces comprehensive test coverage for Anti-Monikers and refines existing moniker composition tests.
It ensures that system monikers behave according to the COM specification when inverted or composed with other types, specifically targeting edge case error handling.

Enhanced Reliability in Moniker Operations

Verification of Anti-Moniker System Behavior

The previously unverified system-level behavior of Anti-Monikers, such as display names and inverse operation errors, has become a guaranteed part of the test suite.

Validation of Composition Rules and Errors

Implicit assumptions about moniker composition became explicit assertions for specific COM error codes, ensuring robust handling of invalid operations.

- Assert `IsSystemMoniker` returns `MKSYS_ANTIMONIKER`.
- Assert `GetDisplayName` returns `"\.."`.
- Assert `GetClassID` returns `CLSID_AntiMoniker`.
- Assert `Inverse` raises `COMError` with `MK_E_NOINVERSE`.
- Assert that composing two anti-monikers with `fOnlyGeneric=False` returns a
  `CLSID_CompositeMoniker`.
- Assert that composing two anti-monikers with `fOnlyGeneric=True` raises
  `COMError` with `MK_E_NEEDGENERIC`.
This commit renames the test method `test_item` to `test_item_with_same_type`
within `test_moniker.py`. This change improves the clarity and descriptiveness
of the test, making its purpose more explicit.
In `test_item_with_same_type` within `test_moniker.py`, rename `mon` to
`left_mon` and `item_mon2` to `right_mon`.
This clarifies the roles of the monikers during the `ComposeWith` call.
This commit introduces new test cases in `test_moniker.py` to verify the
behavior of composing an anti-moniker with a file moniker. It checks both
successful and error scenarios, including handling `MK_E_NEEDGENERIC`.
This commit adds a new test case `test_anti_with_item` to `test_moniker.py`.
This test verifies the correct composition behavior of an anti-moniker with
an item moniker, including checks for expected COM errors and class IDs.
This commit introduces a new test case `test_file_with_same_type` to
`test_moniker.py`. It verifies the behavior of composing file monikers and
asserts that `MK_E_SYNTAX` is raised under specific conditions, extending the
existing test suite for moniker composition.
@junkmd junkmd added this to the 1.4.16 milestone Feb 10, 2026
@junkmd junkmd added the tests enhance or fix tests label Feb 10, 2026
@codecov
Copy link

codecov bot commented Feb 10, 2026

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #922      +/-   ##
==========================================
+ Coverage   88.20%   88.25%   +0.05%     
==========================================
  Files         139      139              
  Lines       13284    13347      +63     
==========================================
+ Hits        11717    11780      +63     
  Misses       1567     1567              

☔ 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 20db830 into enthought:main Feb 10, 2026
81 of 101 checks passed
@junkmd junkmd deleted the anti_moniker_compose_tests branch February 10, 2026 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests enhance or fix tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant