Mercurial > repos > yufei-luo > s_mart
comparison commons/tools/tests/Test_F_ReplaceGreaterThanSymbolInFastaHeader.py @ 18:94ab73e8a190
Uploaded
author | m-zytnicki |
---|---|
date | Mon, 29 Apr 2013 03:20:15 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
17:b0e8584489e6 | 18:94ab73e8a190 |
---|---|
1 import unittest | |
2 import os | |
3 from commons.core.utils.FileUtils import FileUtils | |
4 from commons.tools.tests.MockFastaForReplaceGreaterThanSymbolInFastaHeader import MockFastaForReplaceGreaterThanSymbolInFastaHeader_withoutGreaterThan,\ | |
5 MockFastaForReplaceGreaterThanSymbolInFastaHeader | |
6 from commons.tools.replaceGreaterThanSymbolInFastaHeaderProgramLauncher import replaceGreaterThanSymbolInFastaHeaderProgramLauncher | |
7 | |
8 class Test_F_ReplaceGreaterThanSymbolInHeader(unittest.TestCase): | |
9 | |
10 | |
11 def test_run(self): | |
12 inputFileName = "dummy_fasta.fsa" | |
13 mockInput = MockFastaForReplaceGreaterThanSymbolInFastaHeader() | |
14 mockInput.write(inputFileName) | |
15 | |
16 expFileName = "exp_dummy_fasta.preprocessed.fsa" | |
17 mockInput = MockFastaForReplaceGreaterThanSymbolInFastaHeader_withoutGreaterThan() | |
18 mockInput.write(expFileName) | |
19 | |
20 obsFileName = "dummy_fasta.preprocessed.fasta" | |
21 rgtspl = replaceGreaterThanSymbolInFastaHeaderProgramLauncher() | |
22 rgtspl.setInputFile(inputFileName) | |
23 rgtspl.run() | |
24 | |
25 self.assertTrue(FileUtils.are2FilesIdentical(expFileName, obsFileName)) | |
26 os.remove(inputFileName) | |
27 os.remove(expFileName) | |
28 os.remove(obsFileName) | |
29 | |
30 def test_run_as_script(self): | |
31 inputFileName = "dummy_fasta.fsa" | |
32 mockInput = MockFastaForReplaceGreaterThanSymbolInFastaHeader() | |
33 mockInput.write(inputFileName) | |
34 | |
35 expFileName = "exp_dummy_fasta.preprocessed.fsa" | |
36 mockInput = MockFastaForReplaceGreaterThanSymbolInFastaHeader_withoutGreaterThan() | |
37 mockInput.write(expFileName) | |
38 | |
39 obsFileName = "dummy_fasta.preprocessed.fasta" | |
40 | |
41 cmd2Launch = "replaceGreaterThanSymbolInFastaHeaderProgramLauncher.py -i " + inputFileName | |
42 os.system(cmd2Launch) | |
43 | |
44 self.assertTrue(FileUtils.are2FilesIdentical(expFileName, obsFileName)) | |
45 os.remove(inputFileName) | |
46 os.remove(expFileName) | |
47 os.remove(obsFileName) | |
48 | |
49 | |
50 if __name__ == "__main__": | |
51 unittest.main() |