#NEWLINE# def test_save_related( ) : #NEWLINE# #INDENT# s = Scraper ( juris , '/tmp/' ) #NEWLINE# p = Person ( 'Michael Jordan' ) #NEWLINE# p . add_source ( 'http://example.com' ) #NEWLINE# o = Organization ( 'Chicago Bulls' , classification = 'committee' ) #NEWLINE# o . add_source ( 'http://example.com' ) #NEWLINE# p . _related . append ( o ) #NEWLINE# with mock . patch ( 'json.dump' ) as json_dump : #NEWLINE# #INDENT# s . save_object ( p ) #NEWLINE# #UNINDENT# assert ( json_dump . mock_calls == [ mock . call ( p . as_dict ( ) , mock . ANY , cls = mock . ANY ) , mock . call ( o . as_dict ( ) , mock . ANY , cls = mock . ANY ) ] )