Make the JSON porse a bit more robust.

This commit is contained in:
OK
2023-04-12 19:19:20 +02:00
parent b1ece64874
commit b26b98611a
2 changed files with 18 additions and 16 deletions
+9
View File
@@ -77,6 +77,15 @@ class TestFunctionality(TestBotBase):
json_struct = '{"This is a string."}'
expected_output = 'This is a string.'
self.assertEqual(parse_maybe_json(json_struct), expected_output)
json_struct = '["This is a string."]'
expected_output = 'This is a string.'
self.assertEqual(parse_maybe_json(json_struct), expected_output)
json_struct = '{This is a string.}'
expected_output = 'This is a string.'
self.assertEqual(parse_maybe_json(json_struct), expected_output)
json_struct = '[This is a string.]'
expected_output = 'This is a string.'
self.assertEqual(parse_maybe_json(json_struct), expected_output)
async def test_message_lings(self) -> None:
request = AIMessage('Lala', 'Hello there!', 'chat', False,)