Skip to content

Commit

Permalink
Add test for validating model output without code block markers
Browse files Browse the repository at this point in the history
  • Loading branch information
roribio committed Nov 22, 2024
1 parent 3ee8165 commit 948a79d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/utilities/test_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,13 @@ def test_validate_model_json_output():
assert output == {"name": "Bob", "age": 40}


def test_validate_model_remove_code_block_markers():
result = '```json {"name": "Charlie", "age": 35}```'
output = validate_model(result, SimpleModel, True, None)
assert isinstance(output, dict)
assert output == {"name": "Charlie", "age": 35}


# Tests for handle_partial_json
def test_handle_partial_json_with_valid_partial():
result = 'Some text {"name": "Charlie", "age": 35} more text'
Expand Down

0 comments on commit 948a79d

Please sign in to comment.