This commit is contained in:
femto 2023-09-08 12:12:33 +08:00
parent e6e72c6e23
commit 6755de0ee8
13 changed files with 290 additions and 573 deletions

View file

@ -5,17 +5,16 @@
@Author : femto Zheng
@File : test_custom_decoder.py
"""
import pytest
import json
from metagpt.utils.custom_decoder import CustomDecoder
def test_parse_single_quote():
# Create a custom JSON decoder
decoder = CustomDecoder(strict=False)
# Your provided input with single-quoted strings and line breaks
input_data = '''{'a"
input_data = """{'a"
b':'"title": "Reach and engagement of campaigns",
"x-axis": "Low Reach --> High Reach",
"y-axis": "Low Engagement --> High Engagement",
@ -32,9 +31,8 @@ def test_parse_single_quote():
"Our Target Product": [0.5, 0.6]
'
}
'''
"""
# Parse the JSON using the custom decoder
parsed_data = decoder.decode(input_data)
assert 'a"\n b' in parsed_data