MCPcopy
hub / github.com/pytest-dev/pytest / test_preserve_keys_order

Function test_preserve_keys_order

testing/test_cacheprovider.py:1321–1329  ·  testing/test_cacheprovider.py::test_preserve_keys_order

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

(pytester: Pytester)

Source from the content-addressed store, hash-verified

1319
1320
1321def test_preserve_keys_order(pytester: Pytester) -> None:
1322 class="st">""class="st">"Ensure keys order is preserved when saving dicts (class="cm">#9205)."class="st">""
1323 from _pytest.cacheprovider import Cache
1324
1325 config = pytester.parseconfig()
1326 cache = Cache.for_config(config, _ispytest=True)
1327 cache.set(class="st">"foo", {class="st">"z": 1, class="st">"b": 2, class="st">"a": 3, class="st">"d": 10})
1328 read_back = cache.get(class="st">"foo", None)
1329 assert list(read_back.items()) == [(class="st">"z", 1), (class="st">"b", 2), (class="st">"a", 3), (class="st">"d", 10)]
1330
1331
1332def 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