def test_info(self): args = ['info', self.seq_file, '--out-file', self.tempfile.name, '--threads', str(self.threads)] cli.main(args) self.assertEquals(self.expected.format(self.seq_file), self.tempfile.read())
def test_convert_noformat(self): in_path = p('input2.fasta') cli.main(['convert', in_path, '-']) actual = self.out.getvalue() with open(in_path) as fp: expected = fp.read() self.assertEqual(expected, actual)
def test_description(self): args = ['extract-ids', os.path.join(data_dir, 'input1.fasta'), '-o', self.tempfile.name, '-d'] cli.main(args) self.assertEquals("""test1 test sequence 1 test2 test sequence 2 test3 sequence 3 """, self.tempfile.read())
def test_simple(self): args = ['extract-ids', os.path.join(data_dir, 'input1.fasta'), '-o', self.tempfile.name] cli.main(args) self.assertEquals("""test1 test2 test3 """, self.tempfile.read())
def test_info(self): args = [ 'info', self.seq_file, '--out-file', self.tempfile.name, '--threads', str(self.threads) ] cli.main(args) self.assertEquals(self.expected.format(self.seq_file), self.tempfile.read())
def test_run(self): command = self.command.format(input=self.input_file.name, output=self.output_file) cli.main(shlex.split(command)) with FileType('r')(self.output_file) as fp: actual = fp.read() with FileType('r')(self.expected_path) as fp: expected = fp.read() self.assertEqual(expected, actual)
def test_run(self): command = self.command.format(input=self.input_file) try: cli.main(shlex.split(command)) except SystemExit as e: self.fail(e) with FileType('rt')(self.input_file) as fp: actual = fp.read() with FileType('rt')(self.expected_path) as fp: expected = fp.read() self.assertEqual(expected, actual)
def test_descriptions(self): args = ['extract-ids', self.seq_file, '-o', self.tempfile.name, '-d'] cli.main(args) self.assertEquals(self.expected_desc, self.tempfile.read())
def test_ids(self): args = ['extract-ids', self.seq_file, '-o', self.tempfile.name] cli.main(args) self.assertEquals(self.expected, self.tempfile.read())
def test_run(self): command = self.command.format(input=self.input_file) try: cli.main(shlex.split(command)) except SystemExit, e: self.fail(e)
#!/usr/bin/env python import sys if __name__ == '__main__': from seqmagick.scripts import cli sys.exit(cli.main(sys.argv[1:]))