Skip to content

Commit

Permalink
Added 'test_json_schema'
Browse files Browse the repository at this point in the history
  • Loading branch information
hasansezertasan committed Nov 9, 2023
1 parent ec8a490 commit 470a6da
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/test_phone_numbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,19 @@ def test_parse_error() -> None:
def test_parsed_but_not_a_valid_number() -> None:
with pytest.raises(ValidationError, match='value is not a valid phone number'):
Something(phone_number='+1 555-1212')

def test_json_schema() -> None:
assert Something.model_json_schema() == {
'title': 'Something',
'type': 'object',
'properties': {
'phone_number': {
'title': 'Phone Number',
'type': 'string',
'format': 'tel',
'minLength': 7,
'maxLength': 64,
}
},
'required': ['phone_number'],
}

0 comments on commit 470a6da

Please sign in to comment.