Skip to content

Add test that asserts multidict.MultiDict implements abc.MutableMultiMapping#77

Merged
gerlero merged 4 commits intomainfrom
copilot/fix-8fbcfcff-d788-4e91-b988-bf0cad55af7d
Sep 6, 2025
Merged

Add test that asserts multidict.MultiDict implements abc.MutableMultiMapping#77
gerlero merged 4 commits intomainfrom
copilot/fix-8fbcfcff-d788-4e91-b988-bf0cad55af7d

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Sep 6, 2025

This PR adds a focused test to verify that multidict.MultiDict correctly implements the MutableMultiMapping abstract base class through the existing ABC registration mechanism.

Problem

While the codebase already registers multidict.MultiDict with MutableMultiMapping via MutableMultiMapping.register(multidict.MultiDict) in multicollections/abc.py, there was no explicit test validating that this registration works correctly.

Solution

Added test_multidict_implements_mutable_multi_mapping() which:

  • Creates a multidict.MultiDict instance with sample data
  • Uses isinstance() to verify it's recognized as a MutableMultiMapping
  • Provides a clear assertion that validates the ABC registration
def test_multidict_implements_mutable_multi_mapping() -> None:
    """Test that multidict.MultiDict implements abc.MutableMultiMapping."""
    md = multidict.MultiDict([("a", 1), ("b", 2)])
    assert isinstance(md, MutableMultiMapping)

Testing

The test was validated by:

  1. Confirming it passes with the current registration in place
  2. Temporarily commenting out the registration to verify the test correctly fails
  3. Restoring the registration to confirm the test passes again
  4. Running the full test suite (122 tests) to ensure no regressions

This change provides explicit validation of the ABC implementation relationship that was previously only implicit through the registration code.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…Mapping

Co-authored-by: gerlero <15150530+gerlero@users.noreply.github.com>
Copilot AI changed the title [WIP] Add test that asserts that multidict.MultiDict implements abc.MutableMultiMapping Add test that asserts multidict.MultiDict implements abc.MutableMultiMapping Sep 6, 2025
Copilot AI requested a review from gerlero September 6, 2025 14:43
@gerlero gerlero force-pushed the copilot/fix-8fbcfcff-d788-4e91-b988-bf0cad55af7d branch from e329583 to fb804ac Compare September 6, 2025 14:51
@gerlero gerlero marked this pull request as ready for review September 6, 2025 14:54
Copy link
Copy Markdown
Owner

@gerlero gerlero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Thanks!

@gerlero gerlero merged commit aedd0f5 into main Sep 6, 2025
12 checks passed
@gerlero gerlero deleted the copilot/fix-8fbcfcff-d788-4e91-b988-bf0cad55af7d branch September 6, 2025 14:55
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.

2 participants