def test_sampling_parse_file(file): """Check that parser correctly handles argument `file`. Raise error if file does not exist.""" init = parse([file]) assert init.file == file with pytest.raises(SystemExit): init = parse(["abc"])
def test_sampling_processes(file): """Check that parser correctly handles argument `processes`.""" init = parse([file, "--processes", "4"]) assert init.processes == 4 init = parse([file, "-N", "4"]) assert init.processes == 4 init = parse([file]) assert init.processes == 1
def test_sampling_mf(file): """Check that parser correctly handles argument `mf`.""" init = parse([file, "--mf", "18"]) assert init.mf == [18] init = parse([file, "--mf", "31", "32"]) assert init.mf == [31, 32] init = parse([file]) assert init.mf == [31, 33, 34, 35]
def test_sampling_mat(file): """Check that parser correctly handles argument `mat`.""" init = parse([file, "--mat", "18"]) assert init.mat == [18] init = parse([file, "--mat", "18", "20"]) assert init.mat == [18, 20] init = parse([file]) assert init.mat == list(range(1,10000))
def test_sampling_samples(file): """Check that parser correctly handles argument `samples`. Raise error if file does not exist.""" init = parse([file, "--samples", "3"]) assert init.samples == 3 init = parse([file, "-S", "5"]) assert init.samples == 5 init = parse([file]) assert init.samples == 200
def test_sampling_outdir(tmpdir, file): """Check that parser correctly handles argument `outdir`.""" outdir = os.path.join(str(tmpdir), "AAA") assert not os.path.isdir(outdir) init = parse([file, "--outdir", outdir]) assert init.outdir == outdir assert os.path.isdir(outdir) init = parse([file, "-D", outdir]) assert init.outdir == outdir init = parse([file]) assert init.outdir == os.getcwd()
def test_sampling_parse_cov(file): """Check that parser correctly handles argument `cov`. Raise error if file does not exist.""" init = parse([file, "--cov", file]) assert init.cov == file init = parse([file, "-C", file]) assert init.cov == file init = parse([file]) assert init.cov == None with pytest.raises(SystemExit): init = parse([file, "--cov", "abc"])
def test_sampling_seed31(file): """Check that parser correctly handles argument `seed31`.""" init = parse([file, "--seed31", "4"]) assert init.seed31 == 4 init = parse([file]) assert init.seed31 is None
def test_sampling_parse_help(): """Check that parser correctly handles argument `help`.""" with pytest.raises(SystemExit): parse(["--help"]) with pytest.raises(SystemExit): parse(["-h"])
def test_sampling_parse_version(): """Check that parser correctly handles argument `version`.""" with pytest.raises(SystemExit): parse(["--version"]) with pytest.raises(SystemExit): parse(["-v"])