Skip to content

Commit fe21d61

Browse files
MetRonniedwsutherland
authored andcommitted
Add test & type annotation
1 parent e6c9975 commit fe21d61

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

cylc/flow/data_store_mgr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ def runtime_from_config(rtconfig):
349349
)
350350

351351

352-
def runtime_from_partial(rtconfig, runtimeold=None):
352+
def runtime_from_partial(rtconfig, runtimeold: Optional[PbRuntime] = None):
353353
"""Populate runtime object from partial/full config.
354354
355355
Potentially slower than the non-partial one, due to tha the setattr calls,

tests/unit/network/test_schema.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,12 @@ def test_sort_args(elements, sort_args, expected_result):
9696
assert elements == expected_result
9797

9898

99-
@pytest.mark.parametrize(
100-
'field_name', RUNTIME_FIELD_TO_CFG_MAP.keys()
101-
)
102-
def test_runtime_field_to_cfg_map(field_name: str):
99+
def test_runtime_field_to_cfg_map():
103100
"""Ensure the Runtime type's fields can be mapped back to the workflow
104101
config."""
105-
cfg_name = RUNTIME_FIELD_TO_CFG_MAP[field_name]
106-
assert field_name in Runtime.__dict__
107-
assert WORKFLOW_SPEC.get('runtime', '__MANY__', cfg_name)
102+
assert set(RUNTIME_FIELD_TO_CFG_MAP) == set(Runtime._meta.fields)
103+
for cfg_name in RUNTIME_FIELD_TO_CFG_MAP.values():
104+
assert WORKFLOW_SPEC.get('runtime', '__MANY__', cfg_name)
108105

109106

110107
@pytest.mark.parametrize('runtime_dict,expected', [

0 commit comments

Comments
 (0)