Skip to content

Commit f82b811

Browse files
authored
Fix example code (#1120)
1 parent bd6d8d0 commit f82b811

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/types/objecttypes.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ When we execute a query against that schema.
101101
query_string = "{ me { fullName } }"
102102
result = schema.execute(query_string)
103103
104-
assert result["data"]["me"] == {"fullName": "Luke Skywalker")
104+
assert result.data["me"] == {"fullName": "Luke Skywalker")
105105
106106
Then we go through the following steps to resolve this query:
107107
@@ -212,7 +212,7 @@ If the :ref:`ResolverParamParent` is a dictionary, the resolver will look for a
212212
213213
from graphene import ObjectType, String, Field, Schema
214214
215-
PersonValueObject = namedtuple('Person', ['first_name', 'last_name'])
215+
PersonValueObject = namedtuple("Person", ["first_name", "last_name"])
216216
217217
class Person(ObjectType):
218218
first_name = String()
@@ -224,7 +224,7 @@ If the :ref:`ResolverParamParent` is a dictionary, the resolver will look for a
224224
225225
def resolve_me(parent, info):
226226
# always pass an object for `me` field
227-
return PersonValueObject(first_name='Luke', last_name='Skywalker')
227+
return PersonValueObject(first_name="Luke", last_name="Skywalker")
228228
229229
def resolve_my_best_friend(parent, info):
230230
# always pass a dictionary for `my_best_fiend_field`
@@ -238,10 +238,10 @@ If the :ref:`ResolverParamParent` is a dictionary, the resolver will look for a
238238
}
239239
''')
240240
# With default resolvers we can resolve attributes from an object..
241-
assert result.data['me'] == {"firstName": "Luke", "lastName": "Skywalker"}
241+
assert result.data["me"] == {"firstName": "Luke", "lastName": "Skywalker"}
242242
243243
# With default resolvers, we can also resolve keys from a dictionary..
244-
assert result.data['myBestFriend'] == {"firstName": "R2", "lastName": "D2"}
244+
assert result.data["myBestFriend"] == {"firstName": "R2", "lastName": "D2"}
245245
246246
Advanced
247247
~~~~~~~~

0 commit comments

Comments
 (0)