mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-11 12:16:58 +03:00
Fixed PEP8 errors
This commit is contained in:
parent
2acd8691cf
commit
112006c211
|
@ -4,7 +4,7 @@ from ...core.types.base import FieldType
|
|||
from ...core.types.definitions import List
|
||||
from ...relay import ConnectionField
|
||||
from ...relay.utils import is_node
|
||||
from .utils import get_type_for_model, maybe_queryset, DJANGO_FILTER_INSTALLED
|
||||
from .utils import DJANGO_FILTER_INSTALLED, get_type_for_model, maybe_queryset
|
||||
|
||||
|
||||
class DjangoConnectionField(ConnectionField):
|
||||
|
|
|
@ -2,10 +2,10 @@ import six
|
|||
from django.conf import settings
|
||||
from django.db import models
|
||||
from django.utils.text import capfirst
|
||||
from django_filters import Filter, MultipleChoiceFilter
|
||||
from django_filters.filterset import FilterSet, FilterSetMetaclass
|
||||
from graphql_relay.node.node import from_global_id
|
||||
|
||||
from django_filters import Filter, MultipleChoiceFilter
|
||||
from django_filters.filterset import FilterSet, FilterSetMetaclass
|
||||
from graphene.contrib.django.forms import (GlobalIDFormField,
|
||||
GlobalIDMultipleChoiceField)
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import django_filters
|
||||
|
||||
from graphene.contrib.django.tests.models import Article, Pet, Reporter
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import importlib
|
||||
import json
|
||||
from optparse import make_option
|
||||
from distutils.version import StrictVersion
|
||||
from optparse import make_option
|
||||
|
||||
from django import get_version as get_django_version
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
|
@ -28,6 +28,7 @@ if LT_DJANGO_1_8:
|
|||
)
|
||||
else:
|
||||
class CommandArguments(BaseCommand):
|
||||
|
||||
def add_arguments(self, parser):
|
||||
from django.conf import settings
|
||||
parser.add_argument(
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
from django.core import management
|
||||
from mock import patch
|
||||
from six import StringIO
|
||||
|
||||
from django.core import management
|
||||
|
||||
|
||||
@patch('graphene.contrib.django.management.commands.graphql_schema.Command.save_file')
|
||||
def test_generate_file_on_call_graphql_schema(savefile_mock, settings):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from py.test import raises
|
||||
from tests.utils import assert_equal_lists
|
||||
|
||||
from graphene.contrib.django import DjangoObjectType
|
||||
from tests.utils import assert_equal_lists
|
||||
|
||||
from .models import Reporter
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
from graphql.core.type import GraphQLObjectType
|
||||
from mock import patch
|
||||
from tests.utils import assert_equal_lists
|
||||
|
||||
from graphene import Schema
|
||||
from graphene.contrib.django.types import DjangoNode, DjangoObjectType
|
||||
from graphene.core.fields import Field
|
||||
from graphene.core.types.scalars import Int
|
||||
from graphene.relay.fields import GlobalIDField
|
||||
from tests.utils import assert_equal_lists
|
||||
|
||||
from .models import Article, Reporter
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
from graphql.core import graphql
|
||||
from py.test import raises
|
||||
from tests.utils import assert_equal_lists
|
||||
|
||||
from graphene import Interface, List, ObjectType, Schema, String
|
||||
from graphene.core.fields import Field
|
||||
from graphene.core.types.base import LazyType
|
||||
from tests.utils import assert_equal_lists
|
||||
|
||||
schema = Schema(name='My own schema')
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ def test_to_arguments_wrong_type():
|
|||
|
||||
|
||||
def test_snake_case_args():
|
||||
resolver = lambda instance, args, info: args['my_arg']['inner_arg']
|
||||
def resolver(instance, args, info):
|
||||
return args['my_arg']['inner_arg']
|
||||
r = snake_case_args(resolver)
|
||||
assert r(None, {'myArg': {'innerArg': 3}}, None) == 3
|
||||
|
|
|
@ -25,7 +25,9 @@ def test_orderedtype_different():
|
|||
|
||||
@patch('graphene.core.types.field.Field')
|
||||
def test_type_as_field_called(Field):
|
||||
resolver = lambda x: x
|
||||
def resolver(x):
|
||||
return x
|
||||
|
||||
a = MountedType(2, description='A', resolver=resolver)
|
||||
a.as_field()
|
||||
Field.assert_called_with(
|
||||
|
@ -45,7 +47,8 @@ def test_type_as_argument_called(Argument):
|
|||
|
||||
|
||||
def test_type_as_field():
|
||||
resolver = lambda x: x
|
||||
def resolver(x):
|
||||
return x
|
||||
|
||||
class MyObjectType(ObjectType):
|
||||
t = MountedType(description='A', resolver=resolver)
|
||||
|
|
|
@ -11,7 +11,8 @@ from ..scalars import String
|
|||
|
||||
|
||||
def test_field_internal_type():
|
||||
resolver = lambda *args: 'RESOLVED'
|
||||
def resolver(*args):
|
||||
return 'RESOLVED'
|
||||
|
||||
field = Field(String(), description='My argument', resolver=resolver)
|
||||
|
||||
|
@ -132,7 +133,8 @@ def test_inputfield_internal_type():
|
|||
|
||||
|
||||
def test_field_resolve_argument():
|
||||
resolver = lambda instance, args, info: args.get('first_name')
|
||||
def resolver(instance, args, info):
|
||||
return args.get('first_name')
|
||||
|
||||
field = Field(String(), first_name=String(), description='My argument', resolver=resolver)
|
||||
|
||||
|
|
|
@ -2,7 +2,11 @@ from ..resolve_only_args import resolve_only_args
|
|||
|
||||
|
||||
def test_resolve_only_args():
|
||||
|
||||
def resolver(*args, **kwargs):
|
||||
return kwargs
|
||||
|
||||
my_data = {'one': 1, 'two': 2}
|
||||
resolver = lambda *args, **kwargs: kwargs
|
||||
|
||||
wrapped = resolve_only_args(resolver)
|
||||
assert wrapped(None, my_data, None) == my_data
|
||||
|
|
Loading…
Reference in New Issue
Block a user