Skip to content

Commit 57e05ab

Browse files
committed
🔧 Skip tests for discriminator param (needs Python 3.8+)
1 parent 6728c25 commit 57e05ab

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/test_pydantic/test_field.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
Tests to ensure that the SQLModel `Field` constructor works as
33
expected from the Pydantic `Field` function.
44
"""
5+
import sys
56
from decimal import Decimal
6-
from typing import List, Literal, Optional, Union
7+
from typing import List, Optional, Union
78

89
import pytest
910
from pydantic import ValidationError
@@ -35,9 +36,15 @@ class Model(SQLModel):
3536
Model(unique_strings=["x", "y", "x"])
3637

3738

39+
@pytest.mark.skipif(
40+
sys.version_info < (3, 8), reason="requires Python 3.8+ (for `typing.Literal`)"
41+
)
3842
def test_discriminator():
43+
from typing import Literal
44+
3945
# Example adapted from
4046
# [Pydantic docs](https://pydantic-docs.helpmanual.io/usage/types/#discriminated-unions-aka-tagged-unions):
47+
4148
class Cat(SQLModel):
4249
pet_type: Literal["cat"]
4350
meows: int

0 commit comments

Comments
 (0)