Skip to content

Commit

Permalink
fix coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
collerek committed Jan 31, 2024
1 parent 455e8b5 commit 8590b14
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
10 changes: 7 additions & 3 deletions ormar/fields/base.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import warnings
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Type, Union
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Type, Union, Sequence

import sqlalchemy
from pydantic import typing
from pydantic.fields import FieldInfo, _Unset

import ormar # noqa I101
Expand All @@ -15,6 +14,11 @@

if TYPE_CHECKING: # pragma no cover
from ormar.models import Model, NewBaseModel
from pydantic.fields import FieldInfo

delattr(FieldInfo, "exclude")
else:
from pydantic.fields import FieldInfo


class BaseField(FieldInfo):
Expand Down Expand Up @@ -54,7 +58,7 @@ def __init__(self, **kwargs: Any) -> None:
"https://collerek.github.io/ormar/fields/pydantic-fields",
DeprecationWarning,
)
self.choices: typing.Sequence = kwargs.pop("choices", False)
self.choices: Sequence = kwargs.pop("choices", False)

self.virtual: bool = kwargs.pop(
"virtual", None
Expand Down
5 changes: 1 addition & 4 deletions ormar/fields/many_to_many.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@
from ormar.models import Model, T
from ormar.relations.relation_proxy import RelationProxy

if sys.version_info < (3, 7):
ToType = Type["T"]
else:
ToType = Union[Type["T"], "ForwardRef"]
ToType = Union[Type["T"], "ForwardRef"]

REF_PREFIX = "#/components/schemas/"

Expand Down
2 changes: 1 addition & 1 deletion ormar/models/ormar_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class OrmarConfig:

if TYPE_CHECKING:
if TYPE_CHECKING: # pragma: no cover
pkname: str
metadata: sqlalchemy.MetaData
database: databases.Database
Expand Down

0 comments on commit 8590b14

Please sign in to comment.