<s> from graphql . core . type import GraphQLUnionType <EOL> from graphene . core . schema import Schema <EOL> from graphene . core . types import String <EOL> from . . objecttype import ObjectType <EOL> from . . uniontype import UnionType <EOL> def test_uniontype ( ) : <EOL> class Human ( ObjectType ) : <EOL> name = String ( ) <EOL> class Pet ( ObjectType ) : <EOL> name = String ( ) <EOL> class Thing ( UnionType ) : <EOL> '''<STR_LIT>''' <EOL> class Meta : <EOL> types = [ Human , Pet ] <EOL> schema = Schema ( ) <EOL> object_type = schema . T ( Thing ) <EOL> assert isinstance ( object_type , GraphQLUnionType ) <EOL> assert Thing . _meta . type_name == '<STR_LIT>' <EOL> assert object_type . description == '<STR_LIT>' <EOL> assert object_type . get_possible_types ( ) == [ schema . T ( Human ) , schema . T ( Pet ) ] </s>
