MCPcopy
hub / github.com/lektor/lektor / test_deprecated_data_proxy_methods

Function test_deprecated_data_proxy_methods

tests/test_editor.py:248–285  ·  view source on GitHub ↗
(pad)

Source from the content-addressed store, hash-verified

246
247
248def test_deprecated_data_proxy_methods(pad):
249 editor = make_editor_session(pad, "/")
250
251 with pytest.deprecated_call(match=r"EditorSession\.__contains__ .* deprecated"):
252 assert "arbitrary" not in editor
253
254 with pytest.deprecated_call(match=r"EditorSession\.__setitem__ .* deprecated"):
255 editor["test"] = "value"
256 assert editor.data["test"] == "value"
257 with pytest.deprecated_call(match=r"EditorSession\.__getitem__ .* deprecated"):
258 assert editor["test"] == "value"
259
260 with pytest.deprecated_call(match=r"EditorSession\.update .* deprecated"):
261 editor.update({"test": "another"})
262 assert editor.data["test"] == "another"
263
264 items = set(editor.data.items())
265 with pytest.deprecated_call(match=r"EditorSession\.__len__ .* deprecated"):
266 assert len(editor) == len(items)
267 with pytest.deprecated_call(match=r"EditorSession\.items .* deprecated"):
268 assert set(editor.items()) == items
269 with pytest.deprecated_call(match=r"EditorSession\.__iter__ .* deprecated"):
270 assert set(editor) == set(key for key, val in items)
271 with pytest.deprecated_call(match=r"EditorSession\.keys .* deprecated"):
272 assert set(editor.keys()) == set(key for key, val in items)
273 with pytest.deprecated_call(match=r"EditorSession\.values .* deprecated"):
274 assert set(editor.values()) == set(val for key, val in items)
275
276 with pytest.deprecated_call(match=r"EditorSession\.iteritems .*\.data\.items "):
277 assert set(editor.iteritems()) == items
278 with pytest.deprecated_call(match=r"EditorSession\.iterkeys .*\.data\.keys "):
279 assert set(editor.iterkeys()) == set(key for key, val in items)
280 with pytest.deprecated_call(match=r"EditorSession\.itervalues .*\.data\.values "):
281 assert set(editor.itervalues()) == set(val for key, val in items)
282
283 with pytest.deprecated_call(match=r"EditorSession\.revert_key .* deprecated"):
284 editor.revert_key("test")
285 assert "test" not in editor.data

Callers

nothing calls this directly

Calls 9

make_editor_sessionFunction · 0.90
iteritemsMethod · 0.80
iterkeysMethod · 0.80
itervaluesMethod · 0.80
updateMethod · 0.45
itemsMethod · 0.45
keysMethod · 0.45
valuesMethod · 0.45
revert_keyMethod · 0.45

Tested by

no test coverage detected