<s> from mock import patch <EOL> from graphene . core . types import InputObjectType , ObjectType <EOL> from . . argument import Argument <EOL> from . . base import MountedType , OrderedType <EOL> from . . definitions import List , NonNull <EOL> from . . field import Field , InputField <EOL> def test_orderedtype_equal ( ) : <EOL> a = OrderedType ( ) <EOL> assert a == a <EOL> assert hash ( a ) == hash ( a ) <EOL> def test_orderedtype_different ( ) : <EOL> a = OrderedType ( ) <EOL> b = OrderedType ( ) <EOL> assert a != b <EOL> assert hash ( a ) != hash ( b ) <EOL> assert a < b <EOL> assert b > a <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_type_as_field_called ( Field ) : <EOL> def resolver ( x ) : <EOL> return x <EOL> a = MountedType ( <NUM_LIT:2> , description = '<STR_LIT:A>' , resolver = resolver ) <EOL> a . as_field ( ) <EOL> Field . assert_called_with ( <EOL> a , <EOL> <NUM_LIT:2> , <EOL> _creation_counter = a . creation_counter , <EOL> description = '<STR_LIT:A>' , <EOL> resolver = resolver ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_type_as_argument_called ( Argument ) : <EOL> a = MountedType ( <NUM_LIT:2> , description = '<STR_LIT:A>' ) <EOL> a . as_argument ( ) <EOL> Argument . assert_called_with ( <EOL> a , <NUM_LIT:2> , _creation_counter = a . creation_counter , description = '<STR_LIT:A>' ) <EOL> def test_type_as_field ( ) : <EOL> def resolver ( x ) : <EOL> return x <EOL> class MyObjectType ( ObjectType ) : <EOL> t = MountedType ( description = '<STR_LIT:A>' , resolver = resolver ) <EOL> fields_map = MyObjectType . _meta . fields_map <EOL> field = fields_map . get ( '<STR_LIT:t>' ) <EOL> assert isinstance ( field , Field ) <EOL> assert field . description == '<STR_LIT:A>' <EOL> assert field . object_type == MyObjectType <EOL> def test_type_as_inputfield ( ) : <EOL> class MyObjectType ( InputObjectType ) : <EOL> t = MountedType ( description = '<STR_LIT:A>' ) <EOL> fields_map = MyObjectType . _meta . fields_map <EOL> field = fields_map . get ( '<STR_LIT:t>' ) <EOL> assert isinstance ( field , InputField ) <EOL> assert field . description == '<STR_LIT:A>' <EOL> assert field . object_type == MyObjectType <EOL> def test_type_as_argument ( ) : <EOL> a = MountedType ( description = '<STR_LIT:A>' ) <EOL> argument = a . as_argument ( ) <EOL> assert isinstance ( argument , Argument ) <EOL> def test_type_as_list ( ) : <EOL> m = MountedType ( <NUM_LIT:2> , <NUM_LIT:3> , my_c = '<STR_LIT:A>' ) <EOL> a = m . List <EOL> assert isinstance ( a , List ) <EOL> assert a . of_type == m <EOL> assert a . args == ( <NUM_LIT:2> , <NUM_LIT:3> ) <EOL> assert a . kwargs == { '<STR_LIT>' : '<STR_LIT:A>' } <EOL> def test_type_as_nonnull ( ) : <EOL> m = MountedType ( <NUM_LIT:2> , <NUM_LIT:3> , my_c = '<STR_LIT:A>' ) <EOL> a = m . NonNull <EOL> assert isinstance ( a , NonNull ) <EOL> assert a . of_type == m <EOL> assert a . args == ( <NUM_LIT:2> , <NUM_LIT:3> ) <EOL> assert a . kwargs == { '<STR_LIT>' : '<STR_LIT:A>' } </s>
