<s> """<STR_LIT>""" <EOL> from hamcrest . core . base_matcher import BaseMatcher <EOL> class IsWearingMatcher ( BaseMatcher ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , item , slot ) : <EOL> """<STR_LIT>""" <EOL> super ( ) . __init__ ( ) <EOL> self . item = item <EOL> self . slot = slot <EOL> def _matches ( self , item ) : <EOL> """<STR_LIT>""" <EOL> inventory = item . inventory <EOL> if self . slot == '<STR_LIT>' and inventory . armour == self . item : <EOL> return True <EOL> if self . slot == '<STR_LIT>' and inventory . boots == self . item : <EOL> return True <EOL> return False <EOL> def describe_to ( self , description ) : <EOL> """<STR_LIT>""" <EOL> description . append ( '<STR_LIT>' . format ( self . item ) ) <EOL> def describe_mismatch ( self , item , mismatch_description ) : <EOL> """<STR_LIT>""" <EOL> mismatch_description . append ( '<STR_LIT>' <EOL> . format ( item . inventory ) ) <EOL> class IsInInventoryMatcher ( BaseMatcher ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , item ) : <EOL> """<STR_LIT>""" <EOL> super ( ) . __init__ ( ) <EOL> self . item = item <EOL> def _matches ( self , item ) : <EOL> """<STR_LIT>""" <EOL> return self . item in item . inventory <EOL> def describe_to ( self , description ) : <EOL> """<STR_LIT>""" <EOL> description . append ( '<STR_LIT>' . format ( self . item ) ) <EOL> def describe_mismatch ( self , item , mismatch_description ) : <EOL> """<STR_LIT>""" <EOL> mismatch_description . append ( '<STR_LIT>' <EOL> . format ( item . inventory ) ) <EOL> def is_wearing_armour ( item ) : <EOL> """<STR_LIT>""" <EOL> return IsWearingMatcher ( item , '<STR_LIT>' ) <EOL> def is_wearing_boots ( item ) : <EOL> """<STR_LIT>""" <EOL> return IsWearingMatcher ( item , '<STR_LIT>' ) <EOL> def does_have ( item ) : <EOL> """<STR_LIT>""" <EOL> return IsInInventoryMatcher ( item ) </s>
