|
4 | 4 | import pytest |
5 | 5 | from sqlmodel import Field, SQLModel |
6 | 6 |
|
7 | | -Type5: TypeAlias = str |
8 | | -Type6: TypeAlias = Annotated[str, "Just a comment"] |
9 | | - |
10 | 7 |
|
11 | 8 | @pytest.mark.skipif(version_info[1] < 12, reason="Language feature of Python 3.12+") |
12 | 9 | def test_sa_type_1() -> None: |
13 | 10 | Type1 = str |
14 | 11 |
|
15 | 12 | class Hero1(SQLModel, table=True): |
16 | 13 | pk: int = Field(primary_key=True) |
17 | | - weapon: Type1 = 'sword' |
| 14 | + weapon: Type1 = "sword" |
| 15 | + |
18 | 16 |
|
19 | 17 | @pytest.mark.skipif(version_info[1] < 12, reason="Language feature of Python 3.12+") |
20 | 18 | def test_sa_type_2() -> None: |
21 | 19 | Type2 = Annotated[str, "Just a comment"] |
22 | 20 |
|
23 | 21 | class Hero(SQLModel, table=True): |
24 | 22 | pk: int = Field(primary_key=True) |
25 | | - weapon: Type2 = 'sword' |
| 23 | + weapon: Type2 = "sword" |
| 24 | + |
| 25 | + |
| 26 | +Type3: TypeAlias = str |
| 27 | + |
26 | 28 |
|
27 | 29 | @pytest.mark.skipif(version_info[1] < 12, reason="Language feature of Python 3.12+") |
28 | 30 | def test_sa_type_3() -> None: |
29 | | - type Type3 = str |
30 | | - |
31 | 31 | class Hero(SQLModel, table=True): |
32 | 32 | pk: int = Field(primary_key=True) |
33 | | - weapon: Type3 = 'sword' |
| 33 | + weapon: Type3 = "sword" |
| 34 | + |
| 35 | + |
| 36 | +Type4: TypeAlias = Annotated[str, "Just a comment"] |
| 37 | + |
34 | 38 |
|
35 | 39 | @pytest.mark.skipif(version_info[1] < 12, reason="Language feature of Python 3.12+") |
36 | 40 | def test_sa_type_4() -> None: |
37 | | - type Type4 = Annotated[str, "Just a comment"] |
38 | | - |
39 | 41 | class Hero(SQLModel, table=True): |
40 | 42 | pk: int = Field(primary_key=True) |
41 | | - weapon: Type4 = 'sword' |
| 43 | + weapon: Type4 = "sword" |
| 44 | + |
42 | 45 |
|
43 | 46 | @pytest.mark.skipif(version_info[1] < 12, reason="Language feature of Python 3.12+") |
44 | 47 | def test_sa_type_5() -> None: |
| 48 | + type Type5 = str |
45 | 49 |
|
46 | 50 | class Hero(SQLModel, table=True): |
47 | 51 | pk: int = Field(primary_key=True) |
48 | | - weapon: Type5 = 'sword' |
| 52 | + weapon: Type5 = "sword" |
| 53 | + |
49 | 54 |
|
50 | 55 | @pytest.mark.skipif(version_info[1] < 12, reason="Language feature of Python 3.12+") |
51 | 56 | def test_sa_type_6() -> None: |
| 57 | + type Type6 = Annotated[str, "Just a comment"] |
| 58 | + |
52 | 59 | class Hero(SQLModel, table=True): |
53 | 60 | pk: int = Field(primary_key=True) |
54 | | - weapon: Type6 = 'sword' |
| 61 | + weapon: Type6 = "sword" |
0 commit comments