MCPcopy Create free account
hub / github.com/pytest-dev/pytest / setitem

Method setitem

src/_pytest/monkeypatch.py:264–267  ·  view source on GitHub ↗

Set dictionary entry ``name`` to value.

(self, dic: MutableMapping[K, V], name: K, value: V)

Source from the content-addressed store, hash-verified

262 delattr(target, name)
263
264 def setitem(self, dic: MutableMapping[K, V], name: K, value: V) -> None:
265 """Set dictionary entry ``name`` to value."""
266 self._setitem.append((dic, name, dic.get(name, notset)))
267 dic[name] = value
268
269 def delitem(self, dic: MutableMapping[K, V], name: K, raising: bool = True) -> None:
270 """Delete ``name`` from dict.

Callers 15

setenvMethod · 0.95
test_setitemFunction · 0.95
test_delitemFunction · 0.95
test_add_removedMethod · 0.80
test_restore_reloadedMethod · 0.80
test_preserve_modulesMethod · 0.80
test_canonical_importMethod · 0.80

Calls 2

appendMethod · 0.80
getMethod · 0.45

Tested by 15

test_setitemFunction · 0.76
test_delitemFunction · 0.76
test_add_removedMethod · 0.64
test_restore_reloadedMethod · 0.64
test_preserve_modulesMethod · 0.64
test_canonical_importMethod · 0.64
test_importorskipFunction · 0.64