strawberry-graphql 0.245.0__py3-none-any.whl → 0.246.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import warnings
3
4
  from typing import (
4
5
  Any,
5
6
  Dict,
@@ -16,8 +17,9 @@ class GraphQLTestClient(BaseGraphQLTestClient):
16
17
  query: str,
17
18
  variables: Optional[Dict[str, Mapping]] = None,
18
19
  headers: Optional[Dict[str, object]] = None,
19
- asserts_errors: Optional[bool] = True,
20
+ asserts_errors: Optional[bool] = None,
20
21
  files: Optional[Dict[str, object]] = None,
22
+ assert_no_errors: Optional[bool] = True,
21
23
  ) -> Response:
22
24
  body = self._build_body(query, variables, files)
23
25
 
@@ -29,7 +31,19 @@ class GraphQLTestClient(BaseGraphQLTestClient):
29
31
  data=data.get("data"),
30
32
  extensions=data.get("extensions"),
31
33
  )
32
- if asserts_errors:
34
+
35
+ if asserts_errors is not None:
36
+ warnings.warn(
37
+ "The `asserts_errors` argument has been renamed to `assert_no_errors`",
38
+ DeprecationWarning,
39
+ stacklevel=2,
40
+ )
41
+
42
+ assert_no_errors = (
43
+ assert_no_errors if asserts_errors is None else asserts_errors
44
+ )
45
+
46
+ if assert_no_errors:
33
47
  assert resp.status == 200
34
48
  assert response.errors is None
35
49
 
strawberry/test/client.py CHANGED
@@ -1,6 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import json
4
+ import warnings
4
5
  from abc import ABC, abstractmethod
5
6
  from dataclasses import dataclass
6
7
  from typing import TYPE_CHECKING, Any, Coroutine, Dict, List, Mapping, Optional, Union
@@ -36,8 +37,9 @@ class BaseGraphQLTestClient(ABC):
36
37
  query: str,
37
38
  variables: Optional[Dict[str, Mapping]] = None,
38
39
  headers: Optional[Dict[str, object]] = None,
39
- asserts_errors: Optional[bool] = True,
40
+ asserts_errors: Optional[bool] = None,
40
41
  files: Optional[Dict[str, object]] = None,
42
+ assert_no_errors: Optional[bool] = True,
41
43
  ) -> Union[Coroutine[Any, Any, Response], Response]:
42
44
  body = self._build_body(query, variables, files)
43
45
 
@@ -49,7 +51,19 @@ class BaseGraphQLTestClient(ABC):
49
51
  data=data.get("data"),
50
52
  extensions=data.get("extensions"),
51
53
  )
52
- if asserts_errors:
54
+
55
+ if asserts_errors is not None:
56
+ warnings.warn(
57
+ "The `asserts_errors` argument has been renamed to `assert_no_errors`",
58
+ DeprecationWarning,
59
+ stacklevel=2,
60
+ )
61
+
62
+ assert_no_errors = (
63
+ assert_no_errors if asserts_errors is None else asserts_errors
64
+ )
65
+
66
+ if assert_no_errors:
53
67
  assert response.errors is None
54
68
 
55
69
  return response
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: strawberry-graphql
3
- Version: 0.245.0
3
+ Version: 0.246.0
4
4
  Summary: A library for creating GraphQL APIs
5
5
  Home-page: https://strawberry.rocks/
6
6
  License: MIT
@@ -2,7 +2,7 @@ strawberry/__init__.py,sha256=tJOqxIEg3DYPe48P952sMjF3IxxZqZfIY-kNRlbwBNg,1374
2
2
  strawberry/__main__.py,sha256=3U77Eu21mJ-LY27RG-JEnpbh6Z63wGOom4i-EoLtUcY,59
3
3
  strawberry/aiohttp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  strawberry/aiohttp/test/__init__.py,sha256=4xxdUZtIISSOwjrcnmox7AvT4WWjowCm5bUuPdQneMg,71
5
- strawberry/aiohttp/test/client.py,sha256=4vjTDxtNVfpa74GfUUO7efPI6Ssh1vzfCYp3tPA-SLk,1357
5
+ strawberry/aiohttp/test/client.py,sha256=xPwOo1V0XbC86LWHiSRTLcGNOa796flz49wzWmdkvSs,1775
6
6
  strawberry/aiohttp/views.py,sha256=wbJkcQ1u98tuHa3_mq8OCGzSm57Nnw4DnS5qkILHlEo,7487
7
7
  strawberry/annotation.py,sha256=ftSxGZQUk4C5_5YRM_wNJFVVnZi0XOp71kD7zv4oxbU,13077
8
8
  strawberry/asgi/__init__.py,sha256=aFM74LpXxTruW5a00Ry9rIi3vz7hgnELJvZqPwJnhcY,7645
@@ -194,7 +194,7 @@ strawberry/subscriptions/protocols/graphql_ws/__init__.py,sha256=ijn1A1O0Fzv5p9n
194
194
  strawberry/subscriptions/protocols/graphql_ws/handlers.py,sha256=QxCribyj-EP9SFblbUd4GxK4dMdJe-P8TsjYPwaXf-8,7556
195
195
  strawberry/subscriptions/protocols/graphql_ws/types.py,sha256=CKm4Hy95p6H9u_-QyWdxipwzNeeDIWtilP3RRp8vjPw,1050
196
196
  strawberry/test/__init__.py,sha256=U3B5Ng7C_H8GpCpfvgZZcfADMw6cor5hm78gS3nDdMI,115
197
- strawberry/test/client.py,sha256=-V_5DakR0NJ_Kd5ww4leIhMnIJ-Pf274HkNqYtGVfl8,6044
197
+ strawberry/test/client.py,sha256=Va7J1tIjZ6PxbOqPl57jSp5lNLOZSueHPmrUuUx5sRY,6462
198
198
  strawberry/tools/__init__.py,sha256=pdGpZx8wpq03VfUZJyF9JtYxZhGqzzxCiipsalWxJX4,127
199
199
  strawberry/tools/create_type.py,sha256=jY-6J4VTSrzqc-NbDZpNv7U9L1j1aun5KNGTaGgNcls,2041
200
200
  strawberry/tools/merge_types.py,sha256=noMPqGfbqUaMYMwT_db1rUMaPmmR_uHeFwx7Zd0rivE,1048
@@ -231,8 +231,8 @@ strawberry/utils/logging.py,sha256=U1cseHGquN09YFhFmRkiphfASKCyK0HUZREImPgVb0c,7
231
231
  strawberry/utils/operation.py,sha256=SSXxN-vMqdHO6W2OZtip-1z7y4_A-eTVFdhDvhKeLCk,1193
232
232
  strawberry/utils/str_converters.py,sha256=KGd7QH90RevaJjH6SQEkiVVsb8KuhJr_wv5AsI7UzQk,897
233
233
  strawberry/utils/typing.py,sha256=3xws5kxSQGsp8BnYyUwClvxXNzZakMAuOPoq1rjHRuk,14252
234
- strawberry_graphql-0.245.0.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
235
- strawberry_graphql-0.245.0.dist-info/METADATA,sha256=8mvtyQQnC5lVbvaC5qVhpUXF0q2McBlm39inhtj3F18,7707
236
- strawberry_graphql-0.245.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
237
- strawberry_graphql-0.245.0.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
238
- strawberry_graphql-0.245.0.dist-info/RECORD,,
234
+ strawberry_graphql-0.246.0.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
235
+ strawberry_graphql-0.246.0.dist-info/METADATA,sha256=Ek7Jwznh3RRrwACYxYMg-07468ByfUnyqCgwT7gGyWs,7707
236
+ strawberry_graphql-0.246.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
237
+ strawberry_graphql-0.246.0.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
238
+ strawberry_graphql-0.246.0.dist-info/RECORD,,