

def test_allows_fragment_conditions_to_be_abstract_types():
    ast = parse('\n      {\n        __typename\n        name\n        pets { ...PetFields }\n        friends { ...FriendFields }\n      }\n      fragment PetFields on Pet {\n        __typename\n        ... on Dog {\n          name\n          barks\n        }\n        ... on Cat {\n          name\n          meows\n        }\n      }\n      fragment FriendFields on Named {\n        __typename\n        name\n        ... on Dog {\n          barks\n        }\n        ... on Cat {\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,
        }],
        'friends': [{
            '__typename': 'Person',
            'name': 'Liz',
        }, {
            '__typename': 'Dog',
            'name': 'Odie',
            'barks': True,
        }],
    })

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