• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

aio-libs / multidict / 34777395901
87%

Build:
DEFAULT BRANCH: master
Ran 13 Sep 2026 07:21PM UTC
Jobs 1
Files 33
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

13 Sep 2026 07:20PM UTC coverage: 85.789% (+0.1%) from 85.665%
34777395901

push

github

web-flow
Feat: add the to_dict() (#1288)

## What do these changes do?

Implement `to_dict()` methods for `MultiDict`, `CIMultiDict`,
`MultiDictProxy`, and `CIMultiDictProxy`. This method groups values with
the same key into a list.

### Implementation Details

- **C Extension**: Added `multidict_to_dict` in `_multidict.c` with
direct `PyDict` and `PyList` manipulation for performance.
- **Python Fallback**: Added generic `to_dict` in `_multidict_py.py`.
- **Tests**: Added comprehensive test coverage in
`tests/test_to_dict.py`, including verification of order preservation,
case-insensitivity, mixed types, and proxy mutation isolation.
- **Memory Safety**: Added a new isolated leak check
(`tests/isolated/multidict_to_dict.py`) and integrated it into the CI
suite (`tests/test_leaks.py`). Validated with intentional leak inserted
in code (removed after test).

### Example

```python
md = MultiDict([("a", 1), ("b", 2), ("a", 3)])
md.to_dict()

# Result: {'a': [1, 3], 'b': [2]}
```

## Are there changes in behavior for the user?

No existing behavior changes. This adds a new method `to_dict()` 

## Related issue number

Fixes #783 (Add `to_dict` method)

## Checklist

- [x] I think the code is well written
- [x] Unit tests for the changes exist
- [x] Documentation reflects the changes

---------

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>

663 of 1326 branches covered (50.0%)

Branch coverage included in aggregate %.

196 of 203 new or added lines in 5 files covered. (96.55%)

4746 of 4979 relevant lines covered (95.32%)

1.91 hits per line

Uncovered Changes

Lines Coverage ∆ File
7
82.05
tests/isolated/multidict_to_dict.py
Jobs
ID Job ID Ran Files Coverage
1 MyPy - 34777395901.1 13 Sep 2026 07:21PM UTC 66
85.79
GitHub Action Run
Source Files on build 34777395901
  • Tree
  • List 33
  • Changed 4
  • Source Changed 3
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #34777395901
  • 1f8fef93 on github
  • Prev Build on master (#34705958055)
  • Next Build on master (#34782403362)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc