Skip to content

Check the contents of dictionary view annotations - #573

Open
RavSinghChandan wants to merge 1 commit into
agronholm:masterfrom
RavSinghChandan:check-dict-view-contents
Open

Check the contents of dictionary view annotations#573
RavSinghChandan wants to merge 1 commit into
agronholm:masterfrom
RavSinghChandan:check-dict-view-contents

Conversation

@RavSinghChandan

Copy link
Copy Markdown

KeysView, ValuesView and ItemsView have no checkers registered, so their arguments get dropped:

d = {"a": 1}
check_type(d.keys(), KeysView[int])         # passes
check_type(d.items(), ItemsView[int, str])  # passes - the exact reverse

The views are checked elementwise like the other collections. ItemsView follows check_mapping in reporting the key and the value separately

KeysView, ValuesView and ItemsView had no checkers registered, so they fell
through to a plain isinstance and their arguments were dropped: KeysView[int]
accepted a view over string keys, and ItemsView[int, str] accepted the exact
reverse of what it asked for.

The views are checked elementwise like the other collections, and ItemsView
follows check_mapping in reporting the key and the value separately.
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 94.922% (+0.09%) from 94.83% — RavSinghChandan:check-dict-view-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