

def test_executes_using_union_types():
    ast = parse('\n        {\n            __typename\n            name\n            pets {\n                __typename\n                name\n                barks\n                meows\n            }\n        }\n    ')
    result = execute(schema, john, ast)
    assert (not result.errors)
    assert (result.data == {
        '__typename': 'Person',
        'name': 'John',
        'pets': [{
            '__typename': 'Cat',
            'name': 'Garfield',
            'meows': False,
        }, {
            '__typename': 'Dog',
            'name': 'Odie',
            'barks': True,
        }],
    })

dataset/ETHPy150Open graphql-python/graphql-core/tests/core_execution/test_union_interface.py test_executes_using_union_types/original