mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-12-12 02:45:18 +00:00
Update test_try_fix_yaml.py
test extract snippet with prefix "```" or "```yml"
This commit is contained in:
parent
3e9b15de15
commit
46f889b314
1 changed files with 20 additions and 2 deletions
|
|
@ -21,16 +21,34 @@ class TestTryFixYaml:
|
||||||
|
|
||||||
# The function extracts YAML snippet
|
# The function extracts YAML snippet
|
||||||
def test_extract_snippet(self):
|
def test_extract_snippet(self):
|
||||||
review_text = '''\
|
review_text1 = '''\
|
||||||
Here is the answer in YAML format:
|
Here is the answer in YAML format:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
name: John Smith
|
name: John Smith
|
||||||
age: 35
|
age: 35
|
||||||
```
|
```
|
||||||
|
'''
|
||||||
|
review_text2 = '''\
|
||||||
|
Here is the answer in YAML format:
|
||||||
|
|
||||||
|
```yml
|
||||||
|
name: John Smith
|
||||||
|
age: 35
|
||||||
|
```
|
||||||
|
'''
|
||||||
|
review_text3 = '''\
|
||||||
|
Here is the answer in YAML format:
|
||||||
|
|
||||||
|
```
|
||||||
|
name: John Smith
|
||||||
|
age: 35
|
||||||
|
```
|
||||||
'''
|
'''
|
||||||
expected_output = {'name': 'John Smith', 'age': 35}
|
expected_output = {'name': 'John Smith', 'age': 35}
|
||||||
assert try_fix_yaml(review_text) == expected_output
|
assert try_fix_yaml(review_text1) == expected_output
|
||||||
|
assert try_fix_yaml(review_text2) == expected_output
|
||||||
|
assert try_fix_yaml(review_text3) == expected_output
|
||||||
|
|
||||||
|
|
||||||
# The YAML string is empty.
|
# The YAML string is empty.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue