Skip to content

Commit 81abc3c

Browse files
jawwad-aliclaude
andcommitted
test(workflows): assert self.data preserves the raw non-mapping workflow value
Address review: the previous assertion only proved the key stayed present; it would pass even if construction replaced the malformed value with {}. Assert definition.data["workflow"] equals the original parsed value and is still a non-mapping, proving the guard normalizes only the local variable. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 426dbb8 commit 81abc3c

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

tests/test_workflows.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3626,8 +3626,15 @@ def test_non_mapping_workflow_block_parses_then_validates(self, block):
36263626
assert definition.id == ""
36273627
errors = validate_workflow(definition)
36283628
assert any("workflow.id" in e for e in errors)
3629-
# The raw value is preserved on .data for validation/inspection.
3630-
assert "workflow" in definition.data
3629+
# The RAW malformed value is preserved on .data (the guard only
3630+
# normalizes the local var, not self.data). Assert it was NOT replaced
3631+
# with {} by comparing against the original parse and confirming it is
3632+
# still a non-mapping.
3633+
import yaml
3634+
3635+
raw_workflow = yaml.safe_load(block).get("workflow")
3636+
assert definition.data["workflow"] == raw_workflow
3637+
assert not isinstance(definition.data["workflow"], dict)
36313638

36323639
def test_from_string_invalid(self):
36333640
from specify_cli.workflows.engine import WorkflowDefinition

0 commit comments

Comments
 (0)