Skip to content

groupby method can result in invalid dict #540

@rrssl

Description

@rrssl

Python version
3.13.5

Package version
0.35.0

Current behavior (bug description)

If one of the values of the grouping key contains the path separator, it ends up in the key of the output.

from benedict import benedict

d = benedict({'users': [{'name': 'I.have.dots', 'age': 23}, {'name': 'Blabla', 'age': 42}]})
d.groupby('users', by_key='name')

Output: {'I.have.dots': [{'name': 'I.have.dots', 'age': 23}], 'Blabla': [{'name': 'Blabla', 'age': 42}]}

Expected behavior
I would expect it to raise an error.
Thanks!

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions