#NEWLINE# def test_person_add_membership_org( ) : #NEWLINE# #INDENT# p = Person ( 'Bob B. Bear' ) #NEWLINE# p . add_source ( 'http://example.com' ) #NEWLINE# o = Organization ( 'test org' , classification = 'unknown' ) #NEWLINE# p . add_membership ( o , role = 'member' , start_date = '2007' , end_date = datetime . date ( 2015 , 5 , 8 ) ) #NEWLINE# assert ( len ( p . _related ) == 1 ) #NEWLINE# p . _related [ 0 ] . validate ( ) #NEWLINE# assert ( p . _related [ 0 ] . person_id == p . _id ) #NEWLINE# assert ( p . _related [ 0 ] . organization_id == o . _id ) #NEWLINE# assert ( p . _related [ 0 ] . start_date == '2007' ) #NEWLINE# assert ( p . _related [ 0 ] . end_date == datetime . date ( 2015 , 5 , 8 ) )