chore: improve position map conversion and tolerate empty position yaml file (#6541)
This commit is contained in:
@@ -21,6 +21,20 @@ def prepare_example_positions_yaml(tmp_path, monkeypatch) -> str:
|
||||
return str(tmp_path)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def prepare_empty_commented_positions_yaml(tmp_path, monkeypatch) -> str:
|
||||
monkeypatch.chdir(tmp_path)
|
||||
tmp_path.joinpath("example_positions_all_commented.yaml").write_text(dedent(
|
||||
"""\
|
||||
# - commented1
|
||||
# - commented2
|
||||
-
|
||||
-
|
||||
|
||||
"""))
|
||||
return str(tmp_path)
|
||||
|
||||
|
||||
def test_position_helper(prepare_example_positions_yaml):
|
||||
position_map = get_position_map(
|
||||
folder_path=prepare_example_positions_yaml,
|
||||
@@ -32,3 +46,10 @@ def test_position_helper(prepare_example_positions_yaml):
|
||||
'third': 2,
|
||||
'forth': 3,
|
||||
}
|
||||
|
||||
|
||||
def test_position_helper_with_all_commented(prepare_empty_commented_positions_yaml):
|
||||
position_map = get_position_map(
|
||||
folder_path=prepare_empty_commented_positions_yaml,
|
||||
file_name='example_positions_all_commented.yaml')
|
||||
assert position_map == {}
|
||||
|
||||
Reference in New Issue
Block a user