mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-04 12:50:38 +08:00
re-implemented test case
This commit is contained in:
@ -15,18 +15,6 @@ class TestLoadYaml:
|
|||||||
expected_output = {'name': 'John Smith', 'age': 35}
|
expected_output = {'name': 'John Smith', 'age': 35}
|
||||||
assert load_yaml(yaml_str) == expected_output
|
assert load_yaml(yaml_str) == expected_output
|
||||||
|
|
||||||
def test_load_valid_yaml_with_description(self):
|
|
||||||
yaml_str = '''\
|
|
||||||
Here is the answer in YAML format:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
name: John Smith
|
|
||||||
age: 35
|
|
||||||
```
|
|
||||||
'''
|
|
||||||
expected_output = {'name': 'John Smith', 'age': 35}
|
|
||||||
assert load_yaml(yaml_str) == expected_output
|
|
||||||
|
|
||||||
def test_load_invalid_yaml1(self):
|
def test_load_invalid_yaml1(self):
|
||||||
yaml_str = \
|
yaml_str = \
|
||||||
'''\
|
'''\
|
||||||
|
@ -19,6 +19,19 @@ class TestTryFixYaml:
|
|||||||
expected_output = {"relevant line": "value: 3"}
|
expected_output = {"relevant line": "value: 3"}
|
||||||
assert try_fix_yaml(review_text) == expected_output
|
assert try_fix_yaml(review_text) == expected_output
|
||||||
|
|
||||||
|
# The function extracts YAML snippet
|
||||||
|
def test_extract_snippet(self):
|
||||||
|
review_text = '''\
|
||||||
|
Here is the answer in YAML format:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
name: John Smith
|
||||||
|
age: 35
|
||||||
|
```
|
||||||
|
'''
|
||||||
|
expected_output = {'name': 'John Smith', 'age': 35}
|
||||||
|
assert try_fix_yaml(review_text) == expected_output
|
||||||
|
|
||||||
# The function removes the last line(s) of the YAML string and successfully parses the YAML string.
|
# The function removes the last line(s) of the YAML string and successfully parses the YAML string.
|
||||||
def test_remove_last_line(self):
|
def test_remove_last_line(self):
|
||||||
review_text = "key: value\nextra invalid line\n"
|
review_text = "key: value\nextra invalid line\n"
|
Reference in New Issue
Block a user