[Python-modules-team] Bug#717193: MagicMock does not wrap __setitem__ with wraps=dict()
martin f krafft
madduck at debian.org
Wed Jul 17 19:45:39 UTC 2013
Package: python-mock
Version: 1.0.1-2
Severity: normal
Tags: upstream
>>> import mock
>>> d = {1:2,3:4}
>>> m = mock.MagicMock(spec_set=d.__class__, wraps=d)
>>> print m.items()
[(1, 2), (3, 4)]
>>> m.update({5:6})
>>> print m.items()
[(1, 2), (3, 4), (5, 6)]
So far so good. m behaves like d, because it wraps it.
However:
>>> m[7] = 8
>>> print m.items()
[(1, 2), (3, 4), (5, 6)]]
Unfortunately, __setitem__ is not properly mocked on wrapped dicts.
-- System Information:
Debian Release: jessie/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.10-rc7-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_NZ, LC_CTYPE=en_NZ.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages python-mock depends on:
ii python 2.7.5-2
python-mock recommends no packages.
Versions of packages python-mock suggests:
pn python-mock-doc <none>
-- no debconf information
--
.''`. martin f. krafft <madduck at d.o> Related projects:
: :' : proud Debian developer http://debiansystem.info
`. `'` http://people.debian.org/~madduck http://vcs-pkg.org
`- Debian - when you have better things to do than fixing systems
-------------- next part --------------
A non-text attachment was scrubbed...
Name: digital_signature_gpg.asc
Type: application/pgp-signature
Size: 1124 bytes
Desc: Digital signature (see http://martin-krafft.net/gpg/sig-policy/999bbcc4/current)
URL: <http://lists.alioth.debian.org/pipermail/python-modules-team/attachments/20130717/41874b0b/attachment.sig>
More information about the Python-modules-team
mailing list