From df9a7d8ccca746ad78731fd6af935f8ea97d3375 Mon Sep 17 00:00:00 2001 From: Filippo Martini Date: Tue, 2 Mar 2021 22:06:56 +0100 Subject: [PATCH] Fix tests dataset problem; modify workflow --- .github/workflows/python-PyCTBN-package.yml | 2 +- .idea/.gitignore | 3 +++ .idea/PyCTBN.iml | 8 ++++++++ .idea/inspectionProfiles/profiles_settings.xml | 6 ++++++ .idea/misc.xml | 4 ++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ .../tests/structure_graph/test_networkgraph.py | 2 +- .../tests/structure_graph/test_sample_path.py | 18 +++++++++--------- .../tests/structure_graph/test_trajectory.py | 2 +- 10 files changed, 47 insertions(+), 12 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/PyCTBN.iml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.github/workflows/python-PyCTBN-package.yml b/.github/workflows/python-PyCTBN-package.yml index 717272c..3648c2e 100644 --- a/.github/workflows/python-PyCTBN-package.yml +++ b/.github/workflows/python-PyCTBN-package.yml @@ -36,4 +36,4 @@ jobs: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with pytest run: | - python -m unittest -v PyCTBN/tests/structure_graph/test_sample_path.py + pytest PyCTBN/tests/ diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/PyCTBN.iml b/.idea/PyCTBN.iml new file mode 100644 index 0000000..9b31378 --- /dev/null +++ b/.idea/PyCTBN.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..d1e22ec --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..924bb5b --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PyCTBN/tests/structure_graph/test_networkgraph.py b/PyCTBN/tests/structure_graph/test_networkgraph.py index b41c20a..d9b9bcd 100644 --- a/PyCTBN/tests/structure_graph/test_networkgraph.py +++ b/PyCTBN/tests/structure_graph/test_networkgraph.py @@ -15,7 +15,7 @@ class TestNetworkGraph(unittest.TestCase): @classmethod def setUpClass(cls): cls.read_files = glob.glob(os.path.join('./PyCTBN/test_data', "*.json")) - cls.importer = JsonImporter(cls.read_files[0], 'samples', 'dyn.str', 'variables', 'Time', 'Name') + cls.importer = JsonImporter(cls.read_files[2], 'samples', 'dyn.str', 'variables', 'Time', 'Name') cls.importer.import_data(0) cls.s1 = SamplePath(cls.importer) cls.s1.build_trajectories() diff --git a/PyCTBN/tests/structure_graph/test_sample_path.py b/PyCTBN/tests/structure_graph/test_sample_path.py index 2111d72..f7b3a1a 100644 --- a/PyCTBN/tests/structure_graph/test_sample_path.py +++ b/PyCTBN/tests/structure_graph/test_sample_path.py @@ -17,17 +17,17 @@ class TestSamplePath(unittest.TestCase): cls.read_files = glob.glob(os.path.join('./PyCTBN/test_data', "*.json")) def test_init_not_initialized_importer(self): - importer = JsonImporter(self.read_files[0], 'samples', 'dyn.str', 'variables', 'Time', 'Name') + importer = JsonImporter(self.read_files[2], 'samples', 'dyn.str', 'variables', 'Time', 'Name') self.assertRaises(RuntimeError, SamplePath, importer) def test_init_not_filled_dataframse(self): - importer = JsonImporter(self.read_files[0], 'samples', 'dyn.str', 'variables', 'Time', 'Name') + importer = JsonImporter(self.read_files[2], 'samples', 'dyn.str', 'variables', 'Time', 'Name') importer.import_data(0) importer.clear_concatenated_frame() self.assertRaises(RuntimeError, SamplePath, importer) def test_init(self): - importer = JsonImporter(self.read_files[0], 'samples', 'dyn.str', 'variables', 'Time', 'Name') + importer = JsonImporter(self.read_files[2], 'samples', 'dyn.str', 'variables', 'Time', 'Name') importer.import_data(0) s1 = SamplePath(importer) self.assertIsNone(s1.trajectories) @@ -36,14 +36,14 @@ class TestSamplePath(unittest.TestCase): self.assertIsNone(s1._total_variables_count) def test_build_trajectories(self): - importer = JsonImporter(self.read_files[0], 'samples', 'dyn.str', 'variables', 'Time', 'Name') + importer = JsonImporter(self.read_files[2], 'samples', 'dyn.str', 'variables', 'Time', 'Name') importer.import_data(0) s1 = SamplePath(importer) s1.build_trajectories() self.assertIsInstance(s1.trajectories, Trajectory) def test_build_structure(self): - importer = JsonImporter(self.read_files[0], 'samples', 'dyn.str', 'variables', 'Time', 'Name') + importer = JsonImporter(self.read_files[2], 'samples', 'dyn.str', 'variables', 'Time', 'Name') importer.import_data(0) s1 = SamplePath(importer) s1.build_structure() @@ -51,7 +51,7 @@ class TestSamplePath(unittest.TestCase): self.assertEqual(s1._total_variables_count, len(s1._importer.sorter)) def test_build_structure_bad_sorter(self): - importer = JsonImporter(self.read_files[0], 'samples', 'dyn.str', 'variables', 'Time', 'Name') + importer = JsonImporter(self.read_files[2], 'samples', 'dyn.str', 'variables', 'Time', 'Name') importer.import_data(0) s1 = SamplePath(importer) importer._sorter[0],importer._sorter[1]= importer._sorter[1],importer._sorter[0] @@ -59,7 +59,7 @@ class TestSamplePath(unittest.TestCase): self.assertRaises(RuntimeError, s1.build_structure) def test_build_saplepath_no_prior_net_structure(self): - importer = JsonImporter(self.read_files[0], 'samples', 'dyn.str', 'variables', 'Time', 'Name') + importer = JsonImporter(self.read_files[2], 'samples', 'dyn.str', 'variables', 'Time', 'Name') importer.import_data(0) importer._df_structure = None s1 = SamplePath(importer) @@ -68,13 +68,13 @@ class TestSamplePath(unittest.TestCase): self.assertFalse(s1.structure.edges) def test_buid_samplepath_no_variables(self): - importer = JsonImporter(self.read_files[0], 'samples', 'dyn.str', 'variables', 'Time', 'Name') + importer = JsonImporter(self.read_files[2], 'samples', 'dyn.str', 'variables', 'Time', 'Name') importer.import_data(0) importer._df_variables = None self.assertRaises(RuntimeError, SamplePath, importer) def test_buid_samplepath_no_concatenated_samples(self): - importer = JsonImporter(self.read_files[0], 'samples', 'dyn.str', 'variables', 'Time', 'Name') + importer = JsonImporter(self.read_files[2], 'samples', 'dyn.str', 'variables', 'Time', 'Name') importer.import_data(0) importer._concatenated_samples = None self.assertRaises(RuntimeError, SamplePath, importer) diff --git a/PyCTBN/tests/structure_graph/test_trajectory.py b/PyCTBN/tests/structure_graph/test_trajectory.py index d68f2c1..ae4777b 100644 --- a/PyCTBN/tests/structure_graph/test_trajectory.py +++ b/PyCTBN/tests/structure_graph/test_trajectory.py @@ -12,7 +12,7 @@ class TestTrajectory(unittest.TestCase): @classmethod def setUpClass(cls) -> None: cls.read_files = glob.glob(os.path.join('./PyCTBN/test_data', "*.json")) - cls.importer = JsonImporter(cls.read_files[0], 'samples', 'dyn.str', 'variables', 'Time', 'Name') + cls.importer = JsonImporter(cls.read_files[2], 'samples', 'dyn.str', 'variables', 'Time', 'Name') cls.importer.import_data(0) def test_init(self):