File size: 698 Bytes
2b06d1d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# https://github.com/graphql-python/graphene/issues/356

from pytest import raises

import graphene
from graphene import relay


class SomeTypeOne(graphene.ObjectType):
    pass


class SomeTypeTwo(graphene.ObjectType):
    pass


class MyUnion(graphene.Union):
    class Meta:
        types = (SomeTypeOne, SomeTypeTwo)


def test_issue():
    class Query(graphene.ObjectType):
        things = relay.ConnectionField(MyUnion)

    with raises(Exception) as exc_info:
        graphene.Schema(query=Query)

    assert str(exc_info.value) == (
        "Query fields cannot be resolved."
        " IterableConnectionField type has to be a subclass of Connection."
        ' Received "MyUnion".'
    )