88
99import pytest
1010from graphql import ExecutionResult , GraphQLSchema , graphql , graphql_sync
11- from graphql_sqlalchemy .schema import build_schema
12- from graphql_sqlalchemy .testing import JsonArray
1311from sqlalchemy import Column , Engine , ForeignKey , String , Table
1412from sqlalchemy .ext .asyncio import AsyncEngine , AsyncSession
1513from sqlalchemy .ext .hybrid import hybrid_property
1614from sqlalchemy .orm import DeclarativeBase , Mapped , Session , mapped_column , registry , relationship
1715
16+ from graphql_sqlalchemy .schema import build_schema
17+ from graphql_sqlalchemy .testing import JsonArray
18+
1819if TYPE_CHECKING :
1920 from collections .abc import AsyncGenerator , Callable
2021
@@ -96,7 +97,7 @@ def gql_schema() -> GraphQLSchema:
9697 return build_schema (Base )
9798
9899
99- @pytest .fixture ()
100+ @pytest .fixture
100101async def example_session (
101102 db_engine : Engine | AsyncEngine , db_session : Session | AsyncSession
102103) -> AsyncGenerator [Session | AsyncSession , None ]:
@@ -129,7 +130,7 @@ def raise_if_errors(result: ExecutionResult) -> None:
129130 raise result .errors [0 ] if len (result .errors ) == 1 else ExceptionGroup ("Invalid Query" , result .errors )
130131
131132
132- @pytest .fixture ()
133+ @pytest .fixture
133134def graphql_example (
134135 example_session : Session | AsyncSession , gql_schema : GraphQLSchema
135136) -> Callable [[str ], dict [str , Any ]]:
@@ -155,15 +156,15 @@ async def gql_async(session: AsyncSession) -> ExecutionResult:
155156 return graphql_
156157
157158
158- @pytest .fixture ()
159+ @pytest .fixture
159160def query_example (graphql_example : Callable [[str ], dict [str , Any ]]) -> Callable [[str ], dict [str , Any ]]:
160161 def query (source : str ) -> dict [str , Any ]:
161162 return graphql_example (f"query {{\n { indent (source , ' ' )} \n }}" )
162163
163164 return query
164165
165166
166- @pytest .fixture ()
167+ @pytest .fixture
167168def mutation_example (graphql_example : Callable [[str ], dict [str , Any ]]) -> Callable [[str ], dict [str , Any ]]:
168169 def mutation (source : str ) -> dict [str , Any ]:
169170 return graphql_example (f"mutation {{\n { indent (source , ' ' )} \n }}" )
0 commit comments