def test_pool(): from b4msa.command_line import CommandLine import os import sys fname = os.path.dirname(__file__) + '/text.json' c = CommandLine() sys.argv = ['b4msa', '-k', '2', '-s', '11', '-n', '2', fname] c.main() os.unlink(c.get_output())
def test_output(): from b4msa.command_line import CommandLine import os import sys import tempfile output = tempfile.mktemp() fname = os.path.dirname(__file__) + '/text.json' c = CommandLine() sys.argv = ['b4msa', '-o', output, '-k', '2', fname] c.main() assert os.path.isfile(output) os.unlink(output)
def test_seed(): try: from mock import MagicMock except ImportError: from unittest.mock import MagicMock from b4msa.command_line import CommandLine import os import sys fname = os.path.dirname(__file__) + '/text.json' seed = np.random.seed np.random.seed = MagicMock() c = CommandLine() sys.argv = ['b4msa', '-s', '2', '--seed', '1', '-k', '2', fname] c.main() os.unlink(c.get_output()) np.random.seed.assert_called_once_with(1) np.random.seed = seed
def test_train(): from b4msa.command_line import CommandLine, CommandLineTrain import os import sys import tempfile output = tempfile.mktemp() fname = os.path.dirname(__file__) + '/text.json' c = CommandLine() sys.argv = ['b4msa', '-o', output, '-k', '2', fname, '-s', '2'] c.main() assert os.path.isfile(output) with open(output) as fpt: print(fpt.read()) c = CommandLineTrain() sys.argv = ['b4msa', '-m', output, fname] print(c.main()) os.unlink(output) os.unlink(c.get_output())