From 11bed46a265316d1d18122d2f6dc7d83c5bd45a0 Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Mon, 20 Feb 2017 22:22:54 -0800 Subject: [PATCH] Renamed Generic to GenericScalar --- graphene/types/generic.py | 8 ++++---- graphene/types/tests/test_generic.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/graphene/types/generic.py b/graphene/types/generic.py index 5a8f467f..a1034bfd 100644 --- a/graphene/types/generic.py +++ b/graphene/types/generic.py @@ -7,9 +7,9 @@ from graphene.types.scalars import MIN_INT, MAX_INT from .scalars import Scalar -class Generic(Scalar): +class GenericScalar(Scalar): """ - The `Generic` scalar type represents a generic + The `GenericScalar` scalar type represents a generic GraphQL scalar value that could be: String, Boolean, Int, Float, List or Object. """ @@ -32,8 +32,8 @@ class Generic(Scalar): elif isinstance(ast, FloatValue): return float(ast.value) elif isinstance(ast, ListValue): - return [Generic.parse_literal(value) for value in ast.values] + return [GenericScalar.parse_literal(value) for value in ast.values] elif isinstance(ast, ObjectValue): - return {field.name.value: Generic.parse_literal(field.value) for field in ast.fields} + return {field.name.value: GenericScalar.parse_literal(field.value) for field in ast.fields} else: return None diff --git a/graphene/types/tests/test_generic.py b/graphene/types/tests/test_generic.py index e5e940ba..aede1a8b 100644 --- a/graphene/types/tests/test_generic.py +++ b/graphene/types/tests/test_generic.py @@ -1,10 +1,10 @@ -from ..generic import Generic +from ..generic import GenericScalar from ..objecttype import ObjectType from ..schema import Schema class Query(ObjectType): - generic = Generic(input=Generic()) + generic = GenericScalar(input=GenericScalar()) def resolve_generic(self, args, context, info): input = args.get('input') @@ -45,7 +45,7 @@ def test_generic_query_variable(): None ]: result = schema.execute( - '''query Test($generic: Generic){ generic(input: $generic) }''', + '''query Test($generic: GenericScalar){ generic(input: $generic) }''', variable_values={'generic': generic_value} ) assert not result.errors