#NEWLINE# def test_open_translated( qidoc_action ) : #NEWLINE# #INDENT# translateme_proj = qidoc_action . add_test_project ( 'translateme' ) #NEWLINE# qidoc_action ( 'build' , 'translateme' ) #NEWLINE# with mock . patch ( 'webbrowser.open' ) as mock_open : #NEWLINE# #INDENT# qidoc_action ( 'open' , 'translateme' ) #NEWLINE# index_html = mock_open . call_args [ 0 ] [ 0 ] #NEWLINE# index_html = index_html . replace ( 'file://' , '' ) #NEWLINE# assert os . path . exists ( index_html ) #NEWLINE# #UNINDENT# qidoc_action ( 'build' , 'translateme' , '--language' , 'fr' ) #NEWLINE# with mock . patch ( 'webbrowser.open' ) as mock_open : #NEWLINE# #INDENT# qidoc_action ( 'open' , 'translateme' , '--language' , 'fr' ) #NEWLINE# index_html = mock_open . call_args [ 0 ] [ 0 ] #NEWLINE# index_html = index_html . replace ( 'file://' , '' ) #NEWLINE# assert os . path . exists ( index_html ) #NEWLINE# with open ( mock_open , 'r' ) as fp : #NEWLINE# #INDENT# assert ( 'Cette page' in fp . read ( ) )