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

Function test_preserve_keys_order

testing/test_cacheprovider.py:1213–1221  ·  view source on GitHub ↗

Ensure keys order is preserved when saving dicts (#9205).

(pytester: Pytester)

Source from the content-addressed store, hash-verified

1211
1212
1213def test_preserve_keys_order(pytester: Pytester) -> None:
1214 """Ensure keys order is preserved when saving dicts (#9205)."""
1215 from _pytest.cacheprovider import Cache
1216
1217 config = pytester.parseconfig()
1218 cache = Cache.for_config(config, _ispytest=True)
1219 cache.set("foo", {"z": 1, "b": 2, "a": 3, "d": 10})
1220 read_back = cache.get("foo", None)
1221 assert list(read_back.items()) == [("z", 1), ("b", 2), ("a", 3), ("d", 10)]
1222
1223
1224def test_does_not_create_boilerplate_in_existing_dirs(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 4

for_configMethod · 0.80
setMethod · 0.80
parseconfigMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected