diff --git a/strawberry/experimental/pydantic/object_type.py b/strawberry/experimental/pydantic/object_type.py index 563d8a76b1..f7e87ed6ef 100644 --- a/strawberry/experimental/pydantic/object_type.py +++ b/strawberry/experimental/pydantic/object_type.py @@ -40,7 +40,6 @@ from strawberry.types.type_resolver import _get_fields from strawberry.utils.dataclasses import add_custom_init_fn - if TYPE_CHECKING: from graphql import GraphQLResolveInfo diff --git a/strawberry/experimental/pydantic/pydantic_first_class.py b/strawberry/experimental/pydantic/pydantic_first_class.py index 107407a384..ae4b4d2aae 100644 --- a/strawberry/experimental/pydantic/pydantic_first_class.py +++ b/strawberry/experimental/pydantic/pydantic_first_class.py @@ -1,23 +1,19 @@ +import dataclasses +from typing import Callable, Dict, List, Optional, Sequence, Type + +from pydantic import BaseModel + from strawberry.annotation import StrawberryAnnotation from strawberry.experimental.pydantic._compat import CompatModelField, get_model_fields +from strawberry.experimental.pydantic.conversion_types import PydanticModel from strawberry.experimental.pydantic.fields import replace_types_recursively from strawberry.experimental.pydantic.utils import get_default_factory_for_field from strawberry.field import StrawberryField - - -from pydantic import BaseModel - - -import dataclasses -from typing import Callable, Dict, List, Optional, Sequence, Type - from strawberry.object_type import _get_interfaces from strawberry.types.types import StrawberryObjectDefinition from strawberry.utils.deprecations import DEPRECATION_MESSAGES, DeprecatedDescriptor from strawberry.utils.str_converters import to_camel_case -from strawberry.experimental.pydantic.conversion_types import PydanticModel - def _get_strawberry_fields_from_basemodel( model: Type[BaseModel], is_input: bool, use_pydantic_alias: bool diff --git a/tests/experimental/pydantic_first_class/schema/test_mutation.py b/tests/experimental/pydantic_first_class/schema/test_mutation.py index ef2c1ad758..ed6e60c11e 100644 --- a/tests/experimental/pydantic_first_class/schema/test_mutation.py +++ b/tests/experimental/pydantic_first_class/schema/test_mutation.py @@ -1,12 +1,10 @@ from typing import Dict, List, Union -from graphql import is_valid_name_error import pydantic import pytest import strawberry from strawberry.experimental.pydantic._compat import IS_PYDANTIC_V2 - from strawberry.experimental.pydantic.pydantic_first_class import first_class diff --git a/tests/experimental/pydantic_first_class/schema/test_schema_basic.py b/tests/experimental/pydantic_first_class/schema/test_schema_basic.py index 8f2036aa70..50a7354dd4 100644 --- a/tests/experimental/pydantic_first_class/schema/test_schema_basic.py +++ b/tests/experimental/pydantic_first_class/schema/test_schema_basic.py @@ -1,4 +1,3 @@ -import sys import textwrap from enum import Enum from typing import List, Optional, Union @@ -7,12 +6,8 @@ import pytest import strawberry -from tests.experimental.pydantic.utils import needs_pydantic_v1 - from strawberry.experimental.pydantic.pydantic_first_class import first_class -from strawberry.schema.config import StrawberryConfig - def test_basic_type_field_list(): @first_class() diff --git a/tests/experimental/pydantic_first_class/test_basic.py b/tests/experimental/pydantic_first_class/test_basic.py index 7ebe3098fe..4ddaac397f 100644 --- a/tests/experimental/pydantic_first_class/test_basic.py +++ b/tests/experimental/pydantic_first_class/test_basic.py @@ -1,34 +1,20 @@ -import dataclasses -import sys import textwrap from enum import Enum from typing import Annotated, Any, List, Optional, Union -from graphql import is_input_type import pydantic import pytest import strawberry -from tests.experimental.pydantic.utils import needs_pydantic_v1 - +from strawberry.enum import EnumDefinition from strawberry.experimental.pydantic.pydantic_first_class import ( first_class, ) - -from strawberry.types.types import StrawberryObjectDefinition - +from strawberry.schema_directive import Location from strawberry.type import StrawberryList, StrawberryOptional - -from strawberry.experimental.pydantic.exceptions import MissingFieldsListError - +from strawberry.types.types import StrawberryObjectDefinition from strawberry.union import StrawberryUnion -from strawberry.enum import EnumDefinition - -from strawberry.schema_directive import Location - -from strawberry.experimental.pydantic.pydantic_first_class import register_first_class - def test_basic_type_field_list(): @first_class()