Skip to content

Commit 8cff4f3

Browse files
authored
Merge branch 'master' into append_underscore_to_type_arg
2 parents 01735b1 + 9f678fd commit 8cff4f3

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

graphene/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
from .utils.module_loading import lazy_import
3636

3737

38-
VERSION = (2, 1, 0, 'final', 0)
38+
VERSION = (2, 1, 1, 'final', 0)
3939

4040
__version__ = get_version(VERSION)
4141

graphene/types/dynamic.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import inspect
2+
from functools import partial
23

34
from .mountedtype import MountedType
45

@@ -11,7 +12,7 @@ class Dynamic(MountedType):
1112

1213
def __init__(self, type_, with_schema=False, _creation_counter=None):
1314
super(Dynamic, self).__init__(_creation_counter=_creation_counter)
14-
assert inspect.isfunction(type_)
15+
assert inspect.isfunction(type_) or isinstance(type_, partial)
1516
self.type = type_
1617
self.with_schema = with_schema
1718

graphene/types/tests/test_dynamic.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from functools import partial
12
from ..dynamic import Dynamic
23
from ..scalars import String
34
from ..structures import List, NonNull
@@ -25,3 +26,11 @@ def test_list_non_null():
2526
dynamic = Dynamic(lambda: List(NonNull(String)))
2627
assert dynamic.get_type().of_type.of_type == String
2728
assert str(dynamic.get_type()) == '[String!]'
29+
30+
31+
def test_partial():
32+
def __type(_type):
33+
return _type
34+
dynamic = Dynamic(partial(__type, String))
35+
assert dynamic.get_type() == String
36+
assert str(dynamic.get_type()) == 'String'

0 commit comments

Comments
 (0)