Skip to content

Check the contents of ChainMap, defaultdict and OrderedDict annotations - #574

Open
RavSinghChandan wants to merge 1 commit into
agronholm:masterfrom
RavSinghChandan:check-mapping-subclass-contents
Open

Check the contents of ChainMap, defaultdict and OrderedDict annotations#574
RavSinghChandan wants to merge 1 commit into
agronholm:masterfrom
RavSinghChandan:check-mapping-subclass-contents

Conversation

@RavSinghChandan

Copy link
Copy Markdown

None of the three have checkers registered, so their key and value types get dropped. A plain dict also passes for any of them, since nothing tests the concrete type:

check_type({"a": 1}, OrderedDict[str, int])                    # passes
check_type(defaultdict(int, {1: "a"}), DefaultDict[str, int])  # passes

check_mapping already covers the contents and special-cases dict by origin, so the concrete types are looked up the same way rather than through three near-identical checkers.

Counter is left alone here - it takes a single argument and needs different handling

These three had no checkers registered, so they fell through to a plain
isinstance and their key and value types were dropped. A plain dict also
passed for any of them, since nothing tested the concrete type.

check_mapping already covers the contents and special-cases dict by origin,
so the concrete types are looked up the same way rather than through three
near-identical checkers. Counter is left alone: it takes a single argument
and would need different handling.
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 94.841% (+0.01%) from 94.83% — RavSinghChandan:check-mapping-subclass-contents into agronholm:master

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