mirror of
https://github.com/graphql-python/graphene.git
synced 2025-04-25 03:43:42 +03:00
Compare commits
No commits in common. "master" and "v3.4.0" have entirely different histories.
|
@ -46,7 +46,7 @@ from .types import (
|
|||
from .utils.module_loading import lazy_import
|
||||
from .utils.resolve_only_args import resolve_only_args
|
||||
|
||||
VERSION = (3, 4, 3, "final", 0)
|
||||
VERSION = (3, 4, 0, "final", 0)
|
||||
|
||||
|
||||
__version__ = get_version(VERSION)
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import datetime
|
||||
|
||||
from dateutil.parser import isoparse
|
||||
|
||||
from graphql.error import GraphQLError
|
||||
from graphql.language import StringValueNode, print_ast
|
||||
|
||||
|
@ -73,7 +71,7 @@ class DateTime(Scalar):
|
|||
f"DateTime cannot represent non-string value: {repr(value)}"
|
||||
)
|
||||
try:
|
||||
return isoparse(value)
|
||||
return datetime.datetime.fromisoformat(value)
|
||||
except ValueError:
|
||||
raise GraphQLError(f"DateTime cannot represent value: {repr(value)}")
|
||||
|
||||
|
|
|
@ -227,18 +227,6 @@ def test_time_query_variable(sample_time):
|
|||
assert result.data == {"time": isoformat}
|
||||
|
||||
|
||||
def test_support_isoformat():
|
||||
isoformat = "2011-11-04T00:05:23Z"
|
||||
|
||||
# test time variable provided as Python time
|
||||
result = schema.execute(
|
||||
"""query DateTime($time: DateTime){ datetime(in: $time) }""",
|
||||
variables={"time": isoformat},
|
||||
)
|
||||
assert not result.errors
|
||||
assert result.data == {"datetime": "2011-11-04T00:05:23+00:00"}
|
||||
|
||||
|
||||
def test_bad_variables(sample_date, sample_datetime, sample_time):
|
||||
def _test_bad_variables(type_, input_):
|
||||
result = schema.execute(
|
||||
|
|
|
@ -36,21 +36,6 @@ def test_uuidstring_query_variable():
|
|||
assert result.data == {"uuid": uuid_value}
|
||||
|
||||
|
||||
def test_uuidstring_invalid_argument():
|
||||
uuid_value = {"not": "a string"}
|
||||
|
||||
result = schema.execute(
|
||||
"""query Test($uuid: UUID){ uuid(input: $uuid) }""",
|
||||
variables={"uuid": uuid_value},
|
||||
)
|
||||
assert result.errors
|
||||
assert len(result.errors) == 1
|
||||
assert (
|
||||
result.errors[0].message
|
||||
== "Variable '$uuid' got invalid value {'not': 'a string'}; UUID cannot represent value: {'not': 'a string'}"
|
||||
)
|
||||
|
||||
|
||||
def test_uuidstring_optional_uuid_input():
|
||||
"""
|
||||
Test that we can provide a null value to an optional input
|
||||
|
|
|
@ -51,14 +51,12 @@ class Union(UnmountedType, BaseType):
|
|||
"""
|
||||
|
||||
@classmethod
|
||||
def __init_subclass_with_meta__(cls, types=None, _meta=None, **options):
|
||||
def __init_subclass_with_meta__(cls, types=None, **options):
|
||||
assert (
|
||||
isinstance(types, (list, tuple)) and len(types) > 0
|
||||
), f"Must provide types for Union {cls.__name__}."
|
||||
|
||||
if not _meta:
|
||||
_meta = UnionOptions(cls)
|
||||
|
||||
_meta = UnionOptions(cls)
|
||||
_meta.types = types
|
||||
super(Union, cls).__init_subclass_with_meta__(_meta=_meta, **options)
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from uuid import UUID as _UUID
|
||||
|
||||
from graphql.error import GraphQLError
|
||||
from graphql.language.ast import StringValueNode
|
||||
from graphql import Undefined
|
||||
|
||||
|
@ -29,9 +28,4 @@ class UUID(Scalar):
|
|||
|
||||
@staticmethod
|
||||
def parse_value(value):
|
||||
if isinstance(value, _UUID):
|
||||
return value
|
||||
try:
|
||||
return _UUID(value)
|
||||
except (ValueError, AttributeError):
|
||||
raise GraphQLError(f"UUID cannot represent value: {repr(value)}")
|
||||
return _UUID(value)
|
||||
|
|
7
setup.py
7
setup.py
|
@ -53,11 +53,7 @@ tests_require = [
|
|||
"coveralls>=3.3,<5",
|
||||
]
|
||||
|
||||
dev_requires = [
|
||||
"ruff==0.5.0",
|
||||
"types-python-dateutil>=2.8.1,<3",
|
||||
"mypy>=1.10,<2",
|
||||
] + tests_require
|
||||
dev_requires = ["ruff==0.5.0"] + tests_require
|
||||
|
||||
setup(
|
||||
name="graphene",
|
||||
|
@ -87,7 +83,6 @@ setup(
|
|||
install_requires=[
|
||||
"graphql-core>=3.1,<3.3",
|
||||
"graphql-relay>=3.1,<3.3",
|
||||
"python-dateutil>=2.7.0,<3",
|
||||
"typing-extensions>=4.7.1,<5",
|
||||
],
|
||||
tests_require=tests_require,
|
||||
|
|
Loading…
Reference in New Issue
Block a user