#NEWLINE# def test_set( self ) : #NEWLINE# #INDENT# new_article = self . r . article_set . create ( headline = "John's second story" , pub_date = datetime . date ( 2005 , 7 , 29 ) ) #NEWLINE# new_article2 = self . r2 . article_set . create ( headline = "Paul's story" , pub_date = datetime . date ( 2006 , 1 , 17 ) ) #NEWLINE# new_article2 . reporter = self . r #NEWLINE# new_article2 . save ( ) #NEWLINE# self . assertEqual ( repr ( new_article2 . reporter ) , '<Reporter: John Smith>' ) #NEWLINE# self . assertEqual ( new_article2 . reporter . id , self . r . id ) #NEWLINE# self . assertQuerysetEqual ( self . r . article_set . all ( ) , [ "<Article: John's second story>" , "<Article: Paul's story>" , '<Article: This is a test>' ] ) #NEWLINE# self . assertQuerysetEqual ( self . r2 . article_set . all ( ) , [ ] ) #NEWLINE# self . r2 . article_set . set ( [ new_article , new_article2 ] ) #NEWLINE# self . assertQuerysetEqual ( self . r . article_set . all ( ) , [ '<Article: This is a test>' ] ) #NEWLINE# self . assertQuerysetEqual ( self . r2 . article_set . all ( ) , [ "<Article: John's second story>" , "<Article: Paul's story>" ] ) #NEWLINE# self . r . article_set . set ( [ new_article ] ) #NEWLINE# self . assertQuerysetEqual ( self . r . article_set . all ( ) , [ "<Article: John's second story>" , '<Article: This is a test>' ] ) #NEWLINE# self . assertQuerysetEqual ( self . r2 . article_set . all ( ) , [ "<Article: Paul's story>" ] )