mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-07-04 20:33:12 +03:00
Fixing pylint
This commit is contained in:
parent
44679aefc5
commit
ed1fdc209e
|
@ -1,6 +1,5 @@
|
|||
from functools import partial, reduce
|
||||
|
||||
import six
|
||||
from django.db.models.query import QuerySet
|
||||
from graphene.types import Field, List
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ from graphene_django.converter import get_choices
|
|||
from .forms import GlobalIDFormField, GlobalIDMultipleChoiceField
|
||||
from ..utils import import_single_dispatch
|
||||
|
||||
|
||||
singledispatch = import_single_dispatch()
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from django import forms
|
||||
from py.test import raises
|
||||
|
||||
import graphene
|
||||
from graphene import (
|
||||
String,
|
||||
Int,
|
||||
|
|
|
@ -99,6 +99,7 @@ class FormMutationTests(TestCase):
|
|||
class MyMutation(DjangoFormMutation):
|
||||
class Meta:
|
||||
form_class = MyForm
|
||||
mirror_input = True
|
||||
|
||||
class Mutation(ObjectType):
|
||||
my_mutation = MyMutation.Field()
|
||||
|
@ -128,6 +129,7 @@ class FormMutationTests(TestCase):
|
|||
class MyMutation(DjangoFormMutation):
|
||||
class Meta:
|
||||
form_class = MyForm
|
||||
mirror_input = True
|
||||
|
||||
class Mutation(ObjectType):
|
||||
my_mutation = MyMutation.Field()
|
||||
|
|
|
@ -11,7 +11,6 @@ from graphene.relay import Node
|
|||
from .. import registry
|
||||
from ..settings import graphene_settings
|
||||
from ..types import DjangoObjectType, DjangoObjectTypeOptions
|
||||
from ..converter import convert_choice_field_to_enum
|
||||
from .models import Article as ArticleModel
|
||||
from .models import Reporter as ReporterModel
|
||||
|
||||
|
@ -214,7 +213,6 @@ def with_local_registry(func):
|
|||
@with_local_registry
|
||||
def test_django_objecttype_only_fields():
|
||||
with pytest.warns(PendingDeprecationWarning):
|
||||
|
||||
class Reporter(DjangoObjectType):
|
||||
class Meta:
|
||||
model = ReporterModel
|
||||
|
@ -238,7 +236,6 @@ def test_django_objecttype_fields():
|
|||
@with_local_registry
|
||||
def test_django_objecttype_only_fields_and_fields():
|
||||
with pytest.raises(Exception):
|
||||
|
||||
class Reporter(DjangoObjectType):
|
||||
class Meta:
|
||||
model = ReporterModel
|
||||
|
@ -260,7 +257,6 @@ def test_django_objecttype_all_fields():
|
|||
@with_local_registry
|
||||
def test_django_objecttype_exclude_fields():
|
||||
with pytest.warns(PendingDeprecationWarning):
|
||||
|
||||
class Reporter(DjangoObjectType):
|
||||
class Meta:
|
||||
model = ReporterModel
|
||||
|
@ -284,7 +280,6 @@ def test_django_objecttype_exclude():
|
|||
@with_local_registry
|
||||
def test_django_objecttype_exclude_fields_and_exclude():
|
||||
with pytest.raises(Exception):
|
||||
|
||||
class Reporter(DjangoObjectType):
|
||||
class Meta:
|
||||
model = ReporterModel
|
||||
|
@ -295,7 +290,6 @@ def test_django_objecttype_exclude_fields_and_exclude():
|
|||
@with_local_registry
|
||||
def test_django_objecttype_exclude_and_only():
|
||||
with pytest.raises(AssertionError):
|
||||
|
||||
class Reporter(DjangoObjectType):
|
||||
class Meta:
|
||||
model = ReporterModel
|
||||
|
@ -306,14 +300,12 @@ def test_django_objecttype_exclude_and_only():
|
|||
@with_local_registry
|
||||
def test_django_objecttype_fields_exclude_type_checking():
|
||||
with pytest.raises(TypeError):
|
||||
|
||||
class Reporter(DjangoObjectType):
|
||||
class Meta:
|
||||
model = ReporterModel
|
||||
fields = "foo"
|
||||
|
||||
with pytest.raises(TypeError):
|
||||
|
||||
class Reporter2(DjangoObjectType):
|
||||
class Meta:
|
||||
model = ReporterModel
|
||||
|
@ -323,7 +315,6 @@ def test_django_objecttype_fields_exclude_type_checking():
|
|||
@with_local_registry
|
||||
def test_django_objecttype_fields_exist_on_model():
|
||||
with pytest.warns(UserWarning, match=r"Field name .* doesn't exist"):
|
||||
|
||||
class Reporter(DjangoObjectType):
|
||||
class Meta:
|
||||
model = ReporterModel
|
||||
|
@ -333,7 +324,6 @@ def test_django_objecttype_fields_exist_on_model():
|
|||
UserWarning,
|
||||
match=r"Field name .* matches an attribute on Django model .* but it's not a model field",
|
||||
) as record:
|
||||
|
||||
class Reporter2(DjangoObjectType):
|
||||
class Meta:
|
||||
model = ReporterModel
|
||||
|
@ -341,7 +331,6 @@ def test_django_objecttype_fields_exist_on_model():
|
|||
|
||||
# Don't warn if selecting a custom field
|
||||
with pytest.warns(None) as record:
|
||||
|
||||
class Reporter3(DjangoObjectType):
|
||||
custom_field = String()
|
||||
|
||||
|
@ -358,7 +347,6 @@ def test_django_objecttype_exclude_fields_exist_on_model():
|
|||
UserWarning,
|
||||
match=r"Django model .* does not have a field or attribute named .*",
|
||||
):
|
||||
|
||||
class Reporter(DjangoObjectType):
|
||||
class Meta:
|
||||
model = ReporterModel
|
||||
|
@ -369,7 +357,6 @@ def test_django_objecttype_exclude_fields_exist_on_model():
|
|||
UserWarning,
|
||||
match=r"Excluding the custom field .* on DjangoObjectType .* has no effect.",
|
||||
):
|
||||
|
||||
class Reporter3(DjangoObjectType):
|
||||
custom_field = String()
|
||||
|
||||
|
@ -379,7 +366,6 @@ def test_django_objecttype_exclude_fields_exist_on_model():
|
|||
|
||||
# Don't warn on exclude fields
|
||||
with pytest.warns(None) as record:
|
||||
|
||||
class Reporter4(DjangoObjectType):
|
||||
class Meta:
|
||||
model = ReporterModel
|
||||
|
@ -619,6 +605,7 @@ def test_permission_resolver():
|
|||
class Info(object):
|
||||
class Context(object):
|
||||
user = Viewer()
|
||||
|
||||
context = Context()
|
||||
|
||||
resolved = PermissionArticle.resolve_headline(MyType, Info())
|
||||
|
@ -635,6 +622,7 @@ def test_resolver_without_permission():
|
|||
class Info(object):
|
||||
class Context(object):
|
||||
user = Viewer()
|
||||
|
||||
context = Context()
|
||||
|
||||
resolved = PermissionArticle.resolve_headline(MyType, Info())
|
||||
|
@ -651,6 +639,7 @@ def test_permission_resolver_to_field():
|
|||
class Info(object):
|
||||
class Context(object):
|
||||
user = Viewer()
|
||||
|
||||
context = Context()
|
||||
|
||||
resolved = PermissionArticle.resolve_extra_field(MyType, Info())
|
||||
|
@ -667,6 +656,7 @@ def test_resolver_to_field_without_permission():
|
|||
class Info(object):
|
||||
class Context(object):
|
||||
user = Viewer()
|
||||
|
||||
context = Context()
|
||||
|
||||
resolved = PermissionArticle.resolve_extra_field(MyType, Info())
|
||||
|
|
|
@ -5,7 +5,6 @@ from django.core.exceptions import PermissionDenied
|
|||
from django.db import models
|
||||
from django.db.models.manager import Manager
|
||||
|
||||
|
||||
# from graphene.utils import LazyList
|
||||
from graphene.types.resolver import get_default_resolver
|
||||
from graphene.utils.get_unbound_function import get_unbound_function
|
||||
|
|
Loading…
Reference in New Issue
Block a user