#NEWLINE# def test_update_attrs( self ) : #NEWLINE# #INDENT# class Test ( resource . Resource ) : #NEWLINE# #INDENT# moe = resource . prop ( 'the-attr' ) #NEWLINE# larry = resource . prop ( 'the-attr2' ) #NEWLINE# curly = resource . prop ( 'the-attr3' , type = int ) #NEWLINE# shemp = resource . prop ( 'the-attr4' ) #NEWLINE# #UNINDENT# value1 = 'one' #NEWLINE# value2 = 'two' #NEWLINE# value3 = '3' #NEWLINE# value4 = 'fore' #NEWLINE# value5 = 'fiver' #NEWLINE# sot = Test ( { #NEWLINE# #INDENT# 'the-attr' : value1 , #NEWLINE# #UNINDENT# } ) #NEWLINE# sot . update_attrs ( { #NEWLINE# #INDENT# 'the-attr2' : value2 , #NEWLINE# 'notprop' : value4 , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertTrue ( sot . is_dirty ) #NEWLINE# self . assertEqual ( value1 , sot . moe ) #NEWLINE# self . assertEqual ( value1 , sot [ 'the-attr' ] ) #NEWLINE# self . assertEqual ( value2 , sot . larry ) #NEWLINE# self . assertEqual ( value4 , sot . notprop ) #NEWLINE# sot . _reset_dirty ( ) #NEWLINE# sot . update_attrs ( curly = value3 ) #NEWLINE# self . assertTrue ( sot . is_dirty ) #NEWLINE# self . assertEqual ( int , type ( sot . curly ) ) #NEWLINE# self . assertEqual ( int ( value3 ) , sot . curly ) #NEWLINE# sot . _reset_dirty ( ) #NEWLINE# sot . update_attrs ( ** { #NEWLINE# #INDENT# 'the-attr4' : value5 , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertTrue ( sot . is_dirty ) #NEWLINE# self . assertEqual ( value5 , sot . shemp )