about summary refs log tree commit diff
path: root/tests/test_domagi.py
diff options
context:
space:
mode:
authorArun Isaac2026-08-18 14:44:46 +0100
committerArun Isaac2026-08-21 04:03:20 +0100
commitd2282f6b7453a023af92424309e8713f5c8f7ca7 (patch)
tree457d50052cb9dcab893fcec0a28700f73a259108 /tests/test_domagi.py
parent5d65c47b0388b3e3fa50b8ddfbda4f417af4735f (diff)
downloaddomagi-d2282f6b7453a023af92424309e8713f5c8f7ca7.tar.gz
domagi-d2282f6b7453a023af92424309e8713f5c8f7ca7.tar.lz
domagi-d2282f6b7453a023af92424309e8713f5c8f7ca7.zip
Add chop subcommand.
Diffstat (limited to 'tests/test_domagi.py')
-rw-r--r--tests/test_domagi.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/test_domagi.py b/tests/test_domagi.py
index 38c7c69..61b8e0b 100644
--- a/tests/test_domagi.py
+++ b/tests/test_domagi.py
@@ -52,6 +52,39 @@ def assert_gfa_equal(expected, actual):
 
     assert read_gfa_file(expected) == read_gfa_file(actual)
 
+@pytest.mark.parametrize("test_data_file, chop_to, expected_output",
+                         [(Path("test-data/test3.gfa"),
+                           1,
+                           Path("test-data/expected-output/test3-chop-1.gfa")),
+                          (Path("test-data/test3.gfa"),
+                           2,
+                           Path("test-data/expected-output/test3-chop-2.gfa")),
+                          (Path("test-data/test3.gfa"),
+                           3,
+                           Path("test-data/expected-output/test3-chop-3.gfa")),
+                          (Path("test-data/test3.gfa"),
+                           4,
+                           Path("test-data/expected-output/test3-chop-4.gfa"))])
+def test_domagi_chop(tmp_path, test_data_file, chop_to, expected_output):
+    duckdb_path = tmp_path / f"{test_data_file.stem}.db"
+    output_duckdb_path = tmp_path / f"{test_data_file.stem}-output.db"
+    runner = CliRunner()
+    result = runner.invoke(main, ["build",
+                                  "--gfa", test_data_file,
+                                  "--out", duckdb_path])
+    assert result.exit_code == 0
+    result = runner.invoke(main, ["chop",
+                                  "--db", duckdb_path,
+                                  "--chop-to", chop_to,
+                                  "--out", output_duckdb_path])
+    assert result.exit_code == 0
+    result = runner.invoke(main, ["view",
+                                  "--to-gfa",
+                                  "--db", output_duckdb_path])
+    assert result.exit_code == 0
+    with open(expected_output) as file:
+        assert_gfa_equal(file, io.StringIO(result.stdout))
+
 @pytest.mark.parametrize("test_data_file, expected_output",
                          [(Path("test-data/test-crush.gfa"),
                            Path("test-data/expected-output/test-crush.gfa"))])