Skip to content

dict(\2, **\1) requires all dictionary keys to be strings #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
verhovsky opened this issue May 31, 2021 · 0 comments · Fixed by #73
Closed

dict(\2, **\1) requires all dictionary keys to be strings #54

verhovsky opened this issue May 31, 2021 · 0 comments · Fixed by #73

Comments

@verhovsky
Copy link

As https://www.python.org/dev/peps/pep-0584/#dict-d1-d2 points out,

[dict(d1, **d2)] only works when d2 is entirely string-keyed

>>> d1 = {"spam": 1}
>>> d2 = {3665: 2}
>>> dict(d1, **d2)
Traceback (most recent call last):
 ...
TypeError: keywords must be strings

So, when rewriting self.assertDictContainsSubset(a, b) as assert dict(b, **a) == b, we're introducing a test error if the dict can contain non-string keys.

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 a pull request may close this issue.

1 participant