about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_domagi.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/test_domagi.py b/tests/test_domagi.py
index c65b87e..1ce5fc0 100644
--- a/tests/test_domagi.py
+++ b/tests/test_domagi.py
@@ -19,6 +19,7 @@
 import io
 
 from click.testing import CliRunner
+import duckdb
 import pandas as pd
 from pandas.testing import assert_frame_equal
 from pathlib import Path
@@ -185,6 +186,37 @@ def test_domagi_matrix(tmp_path, test_data_file, expected_output):
 
 @pytest.mark.parametrize("test_data_file, expected_output",
                          [(Path("test-data/test1.gfa"),
+                           Path("test-data/expected-output/test1-overlap")),
+                          (Path("test-data/test2.gfa"),
+                           Path("test-data/expected-output/test2-overlap")),
+                          (Path("test-data/test3.gfa"),
+                           Path("test-data/expected-output/test3-overlap"))])
+def test_domagi_overlap(tmp_path, test_data_file, expected_output):
+    duckdb_path = tmp_path / f"{test_data_file.stem}.db"
+    runner = CliRunner()
+    result = runner.invoke(main, ["build",
+                                  "--gfa", test_data_file,
+                                  "--out", duckdb_path])
+    assert result.exit_code == 0
+    paths = [path for path, in (duckdb.connect(duckdb_path, True)
+                                .execute("SELECT name FROM path")
+                                .fetchall())]
+    result = runner.invoke(main, ["overlap",
+                                  "--db", duckdb_path,
+                                  *sum([["--path", path] for path in paths],
+                                       [])])
+    assert result.exit_code == 0
+    assert_frame_equal(pd.read_csv(expected_output, sep="\t")
+                       .sort_values(by=["#path", "path.touched"],
+                                    ignore_index=True),
+                       pd.read_csv(io.StringIO(result.stdout),
+                                   sep="\t")
+                       .sort_values(by=["#path", "path.touched"],
+                                    ignore_index=True),
+                       check_dtype=False)
+
+@pytest.mark.parametrize("test_data_file, expected_output",
+                         [(Path("test-data/test1.gfa"),
                            Path("test-data/expected-output/test1-paths")),
                           (Path("test-data/test2.gfa"),
                            Path("test-data/expected-output/test2-paths")),