        actual = GqlQuery().fields(['name', field_friends]).query('hero', input={"episode": "$episode"}).operation(
            'query', name='HeroNameAndFriends', input={"$episode": "Episode"}).generate()
        self.assertEqual(expected, actual)

    def test_query_directives(self):
        expected = 'query Hero($episode: Episode, $withFriends: Boolean!) { hero(episode: $episode) { name friends @include(if: $withFriends) { name } } }'
        field_friends = GqlQuery().fields(['name'], name='friends @include(if: $withFriends)').generate()
        actual = GqlQuery().fields(['name', field_friends]).query('hero', input={"episode": "$episode"}).operation(
            'query', name='Hero', input={"$episode": "Episode", "$withFriends": "Boolean!"}).generate()
        self.assertEqual(expected, actual)

    def test_mutation(self):
        expected = 'mutation CreateReviewForEpisode($ep: Episode!, $review: ReviewInput!) { createReview(episode: $ep, review: $review) { stars commentary } }'
        actual = GqlQuery().fields(['stars', 'commentary']).query('createReview', input={"episode": "$ep",