Skip to content

includes raises KeyError for generic mappings #457

Closed

Description

@Gambit-Checkmate

On Windows with Python 3.13.13 and develop at b6bd031:

from collections import UserDict
from types import MappingProxyType
from pydash import includes

source = {"a": 1, "b": 2, "c": 3}
includes(UserDict(source), 2, from_index=1)
includes(MappingProxyType(source), 3, from_index=-1)

Both calls should return True, as they do for the equivalent dict. They raise KeyError because the function sends these mappings to the sequence-slicing branch. I have a focused fix that uses the existing value search for generic mappings and keeps its offset behavior. #338 covered offsets in dicts, and #456 changes group_by.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions