Skip to content

Commit eb986df

Browse files
authored
Remove Client type_def obsolete argument (#262)
1 parent 9951100 commit eb986df

File tree

2 files changed

+3
-33
lines changed

2 files changed

+3
-33
lines changed

gql/client.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import asyncio
2-
import warnings
32
from typing import Any, AsyncGenerator, Dict, Generator, Optional, Union
43

54
from graphql import (
@@ -45,7 +44,6 @@ def __init__(
4544
self,
4645
schema: Optional[Union[str, GraphQLSchema]] = None,
4746
introspection=None,
48-
type_def: Optional[str] = None,
4947
transport: Optional[Union[Transport, AsyncTransport]] = None,
5048
fetch_schema_from_transport: bool = False,
5149
execute_timeout: Optional[Union[int, float]] = 10,
@@ -67,19 +65,6 @@ def __init__(
6765
:param parse_results: Whether gql will try to parse the serialized output
6866
sent by the backend. Can be used to unserialize custom scalars or enums.
6967
"""
70-
assert not (
71-
type_def and introspection
72-
), "Cannot provide introspection and type definition at the same time."
73-
74-
if type_def:
75-
assert (
76-
not schema
77-
), "Cannot provide type definition and schema at the same time."
78-
warnings.warn(
79-
"type_def is deprecated; use schema instead",
80-
category=DeprecationWarning,
81-
)
82-
schema = type_def
8368

8469
if introspection:
8570
assert (

tests/test_async_client_validation.py

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import asyncio
22
import json
3-
import warnings
43

54
import graphql
65
import pytest
@@ -83,7 +82,6 @@ async def server_starwars(ws, path):
8382
[
8483
{"schema": StarWarsSchema},
8584
{"introspection": StarWarsIntrospection},
86-
{"type_def": StarWarsTypeDef},
8785
{"schema": StarWarsTypeDef},
8886
],
8987
)
@@ -97,11 +95,7 @@ async def test_async_client_validation(
9795

9896
sample_transport = WebsocketsTransport(url=url)
9997

100-
with warnings.catch_warnings():
101-
warnings.filterwarnings(
102-
"ignore", message="type_def is deprecated; use schema instead"
103-
)
104-
client = Client(transport=sample_transport, **client_params)
98+
client = Client(transport=sample_transport, **client_params)
10599

106100
async with client as session:
107101

@@ -135,7 +129,6 @@ async def test_async_client_validation(
135129
[
136130
{"schema": StarWarsSchema},
137131
{"introspection": StarWarsIntrospection},
138-
{"type_def": StarWarsTypeDef},
139132
{"schema": StarWarsTypeDef},
140133
],
141134
)
@@ -149,11 +142,7 @@ async def test_async_client_validation_invalid_query(
149142

150143
sample_transport = WebsocketsTransport(url=url)
151144

152-
with warnings.catch_warnings():
153-
warnings.filterwarnings(
154-
"ignore", message="type_def is deprecated; use schema instead"
155-
)
156-
client = Client(transport=sample_transport, **client_params)
145+
client = Client(transport=sample_transport, **client_params)
157146

158147
async with client as session:
159148

@@ -174,11 +163,7 @@ async def test_async_client_validation_invalid_query(
174163
@pytest.mark.parametrize("subscription_str", [starwars_invalid_subscription_str])
175164
@pytest.mark.parametrize(
176165
"client_params",
177-
[
178-
{"schema": StarWarsSchema, "introspection": StarWarsIntrospection},
179-
{"schema": StarWarsSchema, "type_def": StarWarsTypeDef},
180-
{"introspection": StarWarsIntrospection, "type_def": StarWarsTypeDef},
181-
],
166+
[{"schema": StarWarsSchema, "introspection": StarWarsIntrospection}],
182167
)
183168
async def test_async_client_validation_different_schemas_parameters_forbidden(
184169
event_loop, server, subscription_str, client_params

0 commit comments

Comments
 (0)