File tree Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ a query language for APIs created by Facebook.
1313[ ![ Code Style] ( https://img.shields.io/badge/code%20style-black-000000.svg )] ( https://github.com/ambv/black )
1414
1515The current version 1.0.2 of GraphQL-core-next is up-to-date with GraphQL.js version
16- 14.2.1. All parts of the API are covered by an extensive test suite of currently 1742
16+ 14.2.1. All parts of the API are covered by an extensive test suite of currently 1746
1717unit tests.
1818
1919
Original file line number Diff line number Diff line change @@ -446,6 +446,12 @@ def __init__(
446446 self .description = description
447447 self .ast_node = ast_node
448448
449+ def __repr__ (self ):
450+ return f"<{ self .__class__ .__name__ } { self .type !r} >"
451+
452+ def __str__ (self ):
453+ return f"Field: { self .type } "
454+
449455 def __eq__ (self , other ):
450456 return self is other or (
451457 isinstance (other , GraphQLField )
Original file line number Diff line number Diff line change 1010 GraphQLField ,
1111 GraphQLInputField ,
1212 GraphQLInputObjectType ,
13+ GraphQLInt ,
1314 GraphQLInterfaceType ,
1415 GraphQLList ,
1516 GraphQLNonNull ,
1617 GraphQLObjectType ,
1718 GraphQLScalarType ,
19+ GraphQLString ,
1820 GraphQLUnionType ,
1921)
2022
@@ -628,3 +630,17 @@ def simple_types_have_repr():
628630 repr (GraphQLList (ListOfScalarsType ))
629631 == "<GraphQLList <GraphQLList <GraphQLScalarType 'Scalar'>>>"
630632 )
633+
634+ def stringifies_fields ():
635+ assert str (GraphQLField (GraphQLNonNull (GraphQLString ))) == "Field: String!"
636+ assert str (GraphQLField (GraphQLList (GraphQLInt ))) == "Field: [Int]"
637+
638+ def fields_have_repr ():
639+ assert (
640+ repr (GraphQLField (GraphQLNonNull (GraphQLString )))
641+ == "<GraphQLField <GraphQLNonNull <GraphQLScalarType 'String'>>>"
642+ )
643+ assert (
644+ repr (GraphQLField (GraphQLList (GraphQLInt )))
645+ == "<GraphQLField <GraphQLList <GraphQLScalarType 'Int'>>>"
646+ )
You can’t perform that action at this time.
0 commit comments