Skip to content

Commit

Permalink
add a json schema test
Browse files Browse the repository at this point in the history
  • Loading branch information
jbkroner committed Jul 22, 2024
1 parent 7593577 commit d7ffda8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/test_semver.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,12 @@ def test_valid_semver_with_prerelease() -> None:
def test_invalid_semver() -> None:
with pytest.raises(ValueError):
SomethingWithAVersion(version="jim.was.here")


def test_json_schema() -> None:
assert SomethingWithAVersion.model_json_schema() == {
"properties": {"version": {"title": "Version", "type": "string"}},
"required": ["version"],
"title": "SomethingWithAVersion",
"type": "object",
}

0 comments on commit d7ffda8

Please sign in to comment.