Skip to content

Commit

Permalink
Add test for start option
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromekelleher committed Dec 11, 2024
1 parent 05e1920 commit 4b6ab85
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def make_config(
filename = tmp_path / "config.toml"
with open(filename, "w") as f:
toml = tomli_w.dumps(config)
print("Generated", toml)
# print("Generated", toml)
f.write(toml)
return filename

Expand Down Expand Up @@ -232,6 +232,27 @@ def test_first_day(self, tmp_path, fx_ts_map, fx_dataset):
out_ts = tskit.load(ts_path)
out_ts.tables.assert_equals(fx_ts_map[date].tables, ignore_provenance=True)

def test_start(self, tmp_path, fx_ts_map, fx_dataset):
config_file = self.make_config(
tmp_path, fx_dataset, exclude_sites=[56, 57, 58, 59, 60]
)
runner = ct.CliRunner(mix_stderr=False)
result = runner.invoke(
cli.cli,
f"infer {config_file} --stop 2020-01-20",
catch_exceptions=False,
)
date = "2020-01-19"
result = runner.invoke(
cli.cli,
f"infer {config_file} --start={date} --stop 2020-01-20 -f",
catch_exceptions=False,
)
assert result.exit_code == 0
ts_path = tmp_path / "results" / "test" / f"test_{date}.ts"
out_ts = tskit.load(ts_path)
out_ts.tables.assert_equals(fx_ts_map[date].tables, ignore_provenance=True)

def test_include_samples(self, tmp_path, fx_ts_map, fx_dataset):
config_file = self.make_config(
tmp_path,
Expand Down

0 comments on commit 4b6ab85

Please sign in to comment.