Skip to content

Commit

Permalink
Add new YAML processing tests in test_load_yaml.py for snippet extrac…
Browse files Browse the repository at this point in the history
…tion and line removal
  • Loading branch information
mrT23 committed May 25, 2024
1 parent 11e7f70 commit 1452b74
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/test_load_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,16 @@ def test_load_invalid_yaml2(self):
)
== expected_output
)

# auto-generated by cover agent
def test_try_fix_yaml_snippet_extraction():
from cover_agent.utils import try_fix_yaml
yaml_str = "```yaml\nname: John Smith\nage: 35\n```"
expected_output = {"name": "John Smith", "age": 35}
assert try_fix_yaml(yaml_str) == expected_output

def test_try_fix_yaml_remove_all_lines():
from cover_agent.utils import try_fix_yaml
yaml_str = "name: John Smith\nage: 35\ninvalid_line"
expected_output = {"name": "John Smith", "age": 35}
assert try_fix_yaml(yaml_str) == expected_output

0 comments on commit 1452b74

Please sign in to comment.