remove .vscode settings, re-dump orjson choices to fix choices, move mypy config into pyproject.toml
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
import datetime
|
||||
import decimal
|
||||
import uuid
|
||||
from base64 import b64encode
|
||||
from enum import Enum
|
||||
|
||||
import databases
|
||||
@ -60,7 +59,7 @@ class Organisation(ormar.Model):
|
||||
random_decimal: decimal.Decimal = ormar.Decimal(
|
||||
scale=2, precision=4, choices=[decimal.Decimal(12.4), decimal.Decimal(58.2)]
|
||||
)
|
||||
random_json: pydantic.Json = ormar.JSON(choices=["aa", '{"aa":"bb"}'])
|
||||
random_json: pydantic.Json = ormar.JSON(choices=["aa", '{"aa": "bb"}'])
|
||||
random_uuid: uuid.UUID = ormar.UUID(choices=[uuid1, uuid2])
|
||||
enum_string: str = ormar.String(max_length=100, choices=list(EnumTest))
|
||||
blob_col: bytes = ormar.LargeBinary(max_length=100000, choices=[blob, blob2])
|
||||
@ -116,7 +115,7 @@ def test_all_endpoints():
|
||||
"expire_datetime": "2022-05-01T12:30:00",
|
||||
"random_val": 3.5,
|
||||
"random_decimal": 12.4,
|
||||
"random_json": '{"aa":"bb"}',
|
||||
"random_json": '{"aa": "bb"}',
|
||||
"random_uuid": str(uuid1),
|
||||
"enum_string": EnumTest.val1.value,
|
||||
"blob_col": blob.decode("utf-8"),
|
||||
|
||||
@ -131,10 +131,6 @@ def test_all_endpoints():
|
||||
assert items[0].name == "New name"
|
||||
assert items[0].category.name is None
|
||||
|
||||
loop = asyncio.get_event_loop()
|
||||
loop.run_until_complete(items[0].category.load())
|
||||
assert items[0].category.name is not None
|
||||
|
||||
response = client.get(f"/items/{item.pk}")
|
||||
new_item = Item(**response.json())
|
||||
assert new_item == item
|
||||
|
||||
@ -27,7 +27,7 @@ class Mol(ormar.Model):
|
||||
class Meta(BaseMeta):
|
||||
tablename = "mols"
|
||||
|
||||
id: str = ormar.UUID(primary_key=True, index=True, uuid_format="hex")
|
||||
id: uuid.UUID = ormar.UUID(primary_key=True, index=True, uuid_format="hex")
|
||||
smiles: str = ormar.String(nullable=False, unique=True, max_length=256)
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
|
||||
@ -19,9 +19,9 @@ class OverwriteTest(ormar.Model):
|
||||
database = database
|
||||
|
||||
id: int = ormar.Integer(primary_key=True)
|
||||
my_int: str = ormar.Integer(overwrite_pydantic_type=PositiveInt)
|
||||
my_int: int = ormar.Integer(overwrite_pydantic_type=PositiveInt)
|
||||
constraint_dict: Json = ormar.JSON(
|
||||
overwrite_pydantic_type=Optional[Json[Dict[str, int]]]
|
||||
overwrite_pydantic_type=Optional[Json[Dict[str, int]]] # type: ignore
|
||||
)
|
||||
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ class ModelTest(ormar.Model):
|
||||
|
||||
id: int = ormar.Integer(primary_key=True)
|
||||
name: str = ormar.String(max_length=200)
|
||||
url: HttpUrl = "https://www.example.com"
|
||||
url: HttpUrl = "https://www.example.com" # type: ignore
|
||||
number: Optional[PaymentCardNumber]
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ class ModelTest2(ormar.Model):
|
||||
|
||||
id: int = ormar.Integer(primary_key=True)
|
||||
name: str = ormar.String(max_length=200)
|
||||
url: HttpUrl = "https://www.example2.com"
|
||||
url: HttpUrl = "https://www.example2.com" # type: ignore
|
||||
number: PaymentCardNumber = Field(default_factory=get_number)
|
||||
|
||||
|
||||
@ -67,7 +67,7 @@ class ModelTest3(ormar.Model):
|
||||
|
||||
id: int = ormar.Integer(primary_key=True)
|
||||
name: str = ormar.String(max_length=200)
|
||||
url: HttpUrl = "https://www.example3.com"
|
||||
url: HttpUrl = "https://www.example3.com" # type: ignore
|
||||
number: PaymentCardNumber
|
||||
pydantic_test: PydanticTest
|
||||
|
||||
|
||||
Reference in New Issue
Block a user