Skip to content

📝 docs: document that ImmutableMap | merges any Mapping - #84

Merged
nstarman merged 1 commit into
GalacticDynamics:mainfrom
nstarman:docs/immutablemap-or-any-mapping
Oct 10, 2026
Merged

nstarman merged 1 commit into
GalacticDynamics:mainfrom
nstarman:docs/immutablemap-or-any-mapping

Conversation

@nstarman

Copy link
Copy Markdown
Contributor

Since #82, frozendict | other merges only a dict or frozendict, matching the Python 3.15 built-in. ImmutableMap.__or__ deliberately stays looser and merges any Mapping. This PR documents that difference and adds tests so it doesn't change by accident. There is no behaviour change.

Changes

  • ImmutableMap.__or__ docstring: explains that ImmutableMap | other accepts any Mapping, while frozendict | other doesn't, and that the reflected other | ImmutableMap comes from frozendict and is not loosened.
  • README ("Prefer the built-in frozendict" section): one paragraph on this difference, telling users switching to the built-in to wrap such mappings in dict(...).
  • test_or now checks that:
    • ImmutableMap | Plain(...) merges (Plain is a Mapping with no |);
    • frozendict | Plain(...) raises TypeError;
    • Plain(...) | ImmutableMap raises TypeError.

Verification

  • pytest: 135 passed on 3.10 and 3.13 (backport) and on 3.15.0 with jax 0.11.2 (built-in frozendict).
  • prek run --all-files passes.

🤖 Generated with Claude Code

Since GalacticDynamics#82, frozendict | other merges only a dict or frozendict, matching
the Python 3.15 built-in. ImmutableMap.__or__ intentionally stays looser
and merges any Mapping. Document that in the docstring and README, and
pin it (and that the reflected | is not loosened) with a test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@8a48b5e). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff            @@
##             main       #84   +/-   ##
========================================
  Coverage        ?   100.00%           
========================================
  Files           ?         3           
  Lines           ?        98           
  Branches        ?         0           
========================================
  Hits            ?        98           
  Misses          ?         0           
  Partials        ?         0           

☔ View full report in Codecov by Harness.
📢 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.

@nstarman nstarman added this to the v0.3.0 milestone Oct 10, 2026
@nstarman
nstarman merged commit 8135abc into GalacticDynamics:main Oct 10, 2026
18 checks passed
@nstarman
nstarman deleted the docs/immutablemap-or-any-mapping branch October 10, 2026 23:56
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