From 4e06a1c1941f8e265168e065a89ea83bcf7e8399 Mon Sep 17 00:00:00 2001 From: Giorgio Gonnella Date: Thu, 18 Jun 2020 19:02:12 +0200 Subject: [PATCH] add a test on path validations --- tests/test_api_groups_validation.py | 17 +++++++++++++++++ tests/testdata/invalid_path.gfa2 | 6 ++++++ tests/testdata/valid_path.gfa2 | 6 ++++++ 3 files changed, 29 insertions(+) create mode 100644 tests/test_api_groups_validation.py create mode 100644 tests/testdata/invalid_path.gfa2 create mode 100644 tests/testdata/valid_path.gfa2 diff --git a/tests/test_api_groups_validation.py b/tests/test_api_groups_validation.py new file mode 100644 index 0000000..50d92ee --- /dev/null +++ b/tests/test_api_groups_validation.py @@ -0,0 +1,17 @@ +import gfapy +import unittest + +class TestAPIGroupsValidation(unittest.TestCase): + + def test_invalid_path_gfa2(self): + with self.assertRaises(gfapy.NotFoundError): + g = gfapy.Gfa.from_file("tests/testdata/invalid_path.gfa2") + + def test_invalid_path_gfa2_vlevel0(self): + g = gfapy.Gfa.from_file("tests/testdata/invalid_path.gfa2", vlevel = 0) + with self.assertRaises(gfapy.NotFoundError): + g.validate() + + def test_valid_path_gfa2(self): + # nothing raised + g = gfapy.Gfa.from_file("tests/testdata/valid_path.gfa2") diff --git a/tests/testdata/invalid_path.gfa2 b/tests/testdata/invalid_path.gfa2 new file mode 100644 index 0000000..6260753 --- /dev/null +++ b/tests/testdata/invalid_path.gfa2 @@ -0,0 +1,6 @@ +H VN:Z:2.0 +S 1 6 AGCGTA +S 2 6 TAACAG +S 3 6 GCTAGT +S 4 6 TCAGCG +O P1 1+ 2+ 3+ 5+ diff --git a/tests/testdata/valid_path.gfa2 b/tests/testdata/valid_path.gfa2 new file mode 100644 index 0000000..c9e789f --- /dev/null +++ b/tests/testdata/valid_path.gfa2 @@ -0,0 +1,6 @@ +H VN:Z:2.0 +S 1 6 AGCGTA +S 2 6 TAACAG +S 3 6 GCTAGT +S 4 6 TCAGCG +O P1 1+ 2+ 3+ 4+