#NEWLINE# def test_replace( self ) : #NEWLINE# #INDENT# self . _setup ( ordering_list ( 'position' ) ) #NEWLINE# s1 = Slide ( 'Slide #1' ) #NEWLINE# s1 . bullets = [ Bullet ( '1' ) , Bullet ( '2' ) , Bullet ( '3' ) ] #NEWLINE# self . assert_ ( ( len ( s1 . bullets ) == 3 ) ) #NEWLINE# self . assert_ ( ( s1 . bullets [ 2 ] . position == 2 ) ) #NEWLINE# session = create_session ( ) #NEWLINE# session . add ( s1 ) #NEWLINE# session . flush ( ) #NEWLINE# new_bullet = Bullet ( 'new 2' ) #NEWLINE# self . assert_ ( ( new_bullet . position is None ) ) #NEWLINE# s1 . bullets [ 1 ] = new_bullet #NEWLINE# self . assert_ ( ( new_bullet . position == 1 ) ) #NEWLINE# self . assert_ ( ( len ( s1 . bullets ) == 3 ) ) #NEWLINE# id = s1 . id #NEWLINE# session . flush ( ) #NEWLINE# session . expunge_all ( ) #NEWLINE# srt = session . query ( Slide ) . get ( id ) #NEWLINE# self . assert_ ( srt . bullets ) #NEWLINE# self . assert_ ( ( len ( srt . bullets ) == 3 ) ) #NEWLINE# self . assert_ ( ( srt . bullets [ 1 ] . text == 'new 2' ) ) #NEWLINE# self . assert_ ( ( srt . bullets [ 2 ] . text == '3' ) )