diff --git a/tests/unittest/test_load_yaml.py b/tests/unittest/test_load_yaml.py index 34beee35..a77c847b 100644 --- a/tests/unittest/test_load_yaml.py +++ b/tests/unittest/test_load_yaml.py @@ -15,18 +15,6 @@ class TestLoadYaml: expected_output = {'name': 'John Smith', 'age': 35} 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): yaml_str = \ '''\ diff --git a/tests/unittest/try_fix_yaml.py b/tests/unittest/test_try_fix_yaml.py similarity index 75% rename from tests/unittest/try_fix_yaml.py rename to tests/unittest/test_try_fix_yaml.py index fe37bb1c..21ba9211 100644 --- a/tests/unittest/try_fix_yaml.py +++ b/tests/unittest/test_try_fix_yaml.py @@ -19,6 +19,19 @@ class TestTryFixYaml: expected_output = {"relevant line": "value: 3"} 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. def test_remove_last_line(self): review_text = "key: value\nextra invalid line\n" @@ -28,4 +41,4 @@ class TestTryFixYaml: # The YAML string is empty. def test_empty_yaml_fixed(self): review_text = "" - assert try_fix_yaml(review_text) is None \ No newline at end of file + assert try_fix_yaml(review_text) is None