File: test_356.py

package info (click to toggle)
python-graphene 3.4.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,120 kB
  • sloc: python: 8,935; makefile: 214; sh: 18
file content (33 lines) | stat: -rw-r--r-- 698 bytes parent folder | download
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
# 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".'
    )