-
-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add json indentation to config (#1952)
- Loading branch information
Showing
4 changed files
with
40 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,32 @@ | ||
from typing import Any | ||
|
||
import pytest | ||
|
||
from zarr.config import config | ||
|
||
|
||
def test_config_defaults_set(): | ||
def test_config_defaults_set() -> None: | ||
# regression test for available defaults | ||
assert config.defaults == [ | ||
{ | ||
"array": {"order": "C"}, | ||
"async": {"concurrency": None, "timeout": None}, | ||
"codec_pipeline": {"batch_size": 1}, | ||
"json_indent": 2, | ||
} | ||
] | ||
assert config.get("array.order") == "C" | ||
assert config.get("async.concurrency") is None | ||
assert config.get("async.timeout") is None | ||
assert config.get("codec_pipeline.batch_size") == 1 | ||
assert config.get("json_indent") == 2 | ||
|
||
|
||
def test_config_defaults_can_be_overridden(): | ||
assert config.get("array.order") == "C" | ||
with config.set({"array.order": "F"}): | ||
assert config.get("array.order") == "F" | ||
@pytest.mark.parametrize( | ||
"key, old_val, new_val", | ||
[("array.order", "C", "F"), ("async.concurrency", None, 10), ("json_indent", 2, 0)], | ||
) | ||
def test_config_defaults_can_be_overridden(key: str, old_val: Any, new_val: Any) -> None: | ||
assert config.get(key) == old_val | ||
with config.set({key: new_val}): | ||
assert config.get(key) == new_val |