Closed
Description
Patching a dictionary with a Unicode string literal on Python 2 raises the exception TypeError: string indices must be integers
. Running a test.py
file containing the following code
from mock import patch
some_dict = {}
with patch.dict(u'test.some_dict'):
pass
results in
Traceback (most recent call last):
File "test.py", line 5, in <module>
with patch.dict(u'test.some_dict'):
File "C:\Python27\lib\site-packages\mock\mock.py", line 1766, in __enter__
self._patch_dict()
File "C:\Python27\lib\site-packages\mock\mock.py", line 1783, in _patch_dict
original[key] = in_dict[key]
TypeError: string indices must be integers
This is a regression introduced by commit 5268eda.
Metadata
Metadata
Assignees
Labels
No labels