unittest2pytest
unittest2pytest copied to clipboard
dict(\2, **\1) requires all dictionary keys to be strings
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.