Mercurial > repos > yufei-luo > s_mart
view commons/launcher/tests/Test_YassProgramLauncher.py @ 18:94ab73e8a190
Uploaded
author | m-zytnicki |
---|---|
date | Mon, 29 Apr 2013 03:20:15 -0400 |
parents | |
children |
line wrap: on
line source
import unittest from commons.launcher.YassProgramLauncher import YassProgramLauncher class Test_YassProgramLauncher( unittest.TestCase ): def setUp( self ): self._i = YassProgramLauncher() def tearDown( self ): self._i = None def test_getSpecificHelpAsString( self ): exp = "" exp += "\nspecific options:" exp += "\n -s: name of the subject file (format='fasta')" exp += "\n -p: parameters for 'yass'" exp += "\n -A: same sequences (all-by-all)" exp += "\n -o: name of the output file (format='align', default=inFile+'.align')" obs = self._i.getSpecificHelpAsString() self.assertEqual( exp, obs ) def test_setASpecificAttributeFromCmdLine( self ): self._i.setASpecificAttributeFromCmdLine( "-s", "dummySubjectFile.fa" ) self.assertEqual( "dummySubjectFile.fa", self._i.getSubjectFile() ) self._i.setASpecificAttributeFromCmdLine( "-o", "dummyOutFile.align" ) self.assertEqual( "dummyOutFile.align", self._i.getOutputFile() ) def test_setWrapperCommandLine( self ): self._i.setInputFile( "dummyInFile.fa" ) self._i.setSubjectFile( "dummySubjectFile.fa" ) exp = "YassProgramLauncher.py" exp += " -i %s" % ( "dummyInFile.fa" ) exp += " -s %s" % ( "dummySubjectFile.fa" ) exp += " -o %s.align" % ( "dummyInFile.fa" ) exp += " -v 0" self._i.setWrapperCommandLine() obs = self._i.getWrapperCommandLine() self.assertEqual( exp, obs ) def test_setProgramCommandLine( self ): self._i.setInputFile( "dummyInFile.fa" ) self._i.setSubjectFile( "dummySubjectFile.fa" ) exp = "yass -d 2 -o dummyInFile.fa.blast dummyInFile.fa dummySubjectFile.fa" self._i.setProgramCommandLine() obs = self._i.getProgramCommandLine() self.assertEqual( exp, obs ) def test_setListFilesToKeep( self ): self._i.setInputFile( "dummyInFile.fa" ) lExp = [ "dummyInFile.fa.align" ] self._i.setListFilesToKeep() lObs = self._i.getListFilesToKeep() lExp.sort() lObs.sort() self.assertEqual( lExp, lObs ) def test_setSummary( self ): self._i.setInputFile( "dummyInFile.fa" ) self._i.setSubjectFile( "dummySubjectFile.fa" ) exp = "input file: %s" % ( self._i.getInputFile() ) exp += "\nsubject file: %s" % ( self._i.getSubjectFile() ) exp += "\nparameters: %s" % ( self._i.getProgramParameters() ) exp += "\noutput file: %s" % ( "dummyInFile.fa.align" ) self._i.setSummary() obs = self._i.getSummary() self.assertEqual( exp, obs ) if __name__ == "__main__": unittest.main()