mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-04-29 19:06:23 +02:00
parse_triple_quote
This commit is contained in:
parent
749c60e9eb
commit
dd8be8a382
4 changed files with 62 additions and 17 deletions
|
|
@ -36,3 +36,37 @@ def test_parse_single_quote():
|
|||
|
||||
parsed_data = decoder.decode(input_data)
|
||||
assert 'a"\n b' in parsed_data
|
||||
|
||||
|
||||
def test_parse_triple_double_quote():
|
||||
# Create a custom JSON decoder
|
||||
decoder = CustomDecoder(strict=False)
|
||||
# Your provided input with single-quoted strings and line breaks
|
||||
input_data = '{"""a""":"b"}'
|
||||
# Parse the JSON using the custom decoder
|
||||
|
||||
parsed_data = decoder.decode(input_data)
|
||||
assert "a" in parsed_data
|
||||
|
||||
input_data = '{"""a""":"""b"""}'
|
||||
# Parse the JSON using the custom decoder
|
||||
|
||||
parsed_data = decoder.decode(input_data)
|
||||
assert parsed_data["a"] == "b"
|
||||
|
||||
|
||||
def test_parse_triple_single_quote():
|
||||
# Create a custom JSON decoder
|
||||
decoder = CustomDecoder(strict=False)
|
||||
# Your provided input with single-quoted strings and line breaks
|
||||
input_data = "{'''a''':'b'}"
|
||||
# Parse the JSON using the custom decoder
|
||||
|
||||
parsed_data = decoder.decode(input_data)
|
||||
assert "a" in parsed_data
|
||||
|
||||
input_data = "{'''a''':'''b'''}"
|
||||
# Parse the JSON using the custom decoder
|
||||
|
||||
parsed_data = decoder.decode(input_data)
|
||||
assert parsed_data["a"] == "b"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue