#NEWLINE# def test_minimize_and_maximize( self ) : #NEWLINE# #INDENT# ' minimize and maximize ' #NEWLINE# class IFoo ( Interface ) : #NEWLINE# #INDENT# price = Int #NEWLINE# #UNINDENT# @ provides ( IFoo ) #NEWLINE# class Foo ( HasTraits ) : #NEWLINE# #INDENT# price = Int #NEWLINE# #UNINDENT# x = Foo ( price = 10 ) #NEWLINE# y = Foo ( price = 5 ) #NEWLINE# z = Foo ( price = 100 ) #NEWLINE# for foo in [ x , y , z ] : #NEWLINE# #INDENT# self . service_registry . register_service ( IFoo , foo ) #NEWLINE# #UNINDENT# service = self . service_registry . get_service ( IFoo , minimize = 'price' ) #NEWLINE# self . assertNotEqual ( None , service ) #NEWLINE# self . assertEqual ( Foo , type ( service ) ) #NEWLINE# self . assertEqual ( y , service ) #NEWLINE# service = self . service_registry . get_service ( IFoo , maximize = 'price' ) #NEWLINE# self . assertNotEqual ( None , service ) #NEWLINE# self . assertEqual ( Foo , type ( service ) ) #NEWLINE# self . assertEqual ( z , service ) #NEWLINE# return