#NEWLINE# def test_command_version( ) : #NEWLINE# #INDENT# class VersionCommandLine ( Application ) : #NEWLINE# #INDENT# @ command ( description = 'test' , prog = 'Basic' ) #NEWLINE# @ param ( '--force' , action = 'store_true' , dest = 'force1' ) #NEWLINE# @ param ( '--force2' , action = 'store' , dest = 'force2' ) #NEWLINE# @ version ( '--version' , version = '%(prog)s 1.0' ) #NEWLINE# def main( self , params ) : #NEWLINE# #INDENT# assert ( params . force1 == eval ( params . force2 ) ) #NEWLINE# self . _main ( ) #NEWLINE# #UNINDENT# def _main( self ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# with patch . object ( VersionCommandLine , '_main' ) as _main : #NEWLINE# #INDENT# c = VersionCommandLine ( ) #NEWLINE# exception = False #NEWLINE# try : #NEWLINE# #INDENT# c . parse ( [ '--version' ] ) #NEWLINE# assert False #NEWLINE# #UNINDENT# except SystemExit : #NEWLINE# #INDENT# exception = True #NEWLINE# #UNINDENT# assert exception #NEWLINE# assert ( not exception . called )