1
0
Fork 0
pydantic-extra-types/tests/test_semver.py
Daniel Baumann 5c6459935a
Adding upstream version 2.10.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
2025-02-05 14:06:20 +01:00

21 lines
502 B
Python

import pytest
from pydantic import BaseModel
from pydantic_extra_types.semver import _VersionPydanticAnnotation
class SomethingWithAVersion(BaseModel):
version: _VersionPydanticAnnotation
def test_valid_semver() -> None:
SomethingWithAVersion(version='1.2.3')
def test_valid_semver_with_prerelease() -> None:
SomethingWithAVersion(version='1.2.3-alpha.1')
def test_invalid_semver() -> None:
with pytest.raises(ValueError):
SomethingWithAVersion(version='jim.was.here')