|
|
@ -17,17 +17,17 @@ class TestSamplePath(unittest.TestCase): |
|
|
|
cls.read_files = glob.glob(os.path.join('./PyCTBN/test_data', "*.json")) |
|
|
|
cls.read_files = glob.glob(os.path.join('./PyCTBN/test_data', "*.json")) |
|
|
|
|
|
|
|
|
|
|
|
def test_init_not_initialized_importer(self): |
|
|
|
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) |
|
|
|
self.assertRaises(RuntimeError, SamplePath, importer) |
|
|
|
|
|
|
|
|
|
|
|
def test_init_not_filled_dataframse(self): |
|
|
|
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.import_data(0) |
|
|
|
importer.clear_concatenated_frame() |
|
|
|
importer.clear_concatenated_frame() |
|
|
|
self.assertRaises(RuntimeError, SamplePath, importer) |
|
|
|
self.assertRaises(RuntimeError, SamplePath, importer) |
|
|
|
|
|
|
|
|
|
|
|
def test_init(self): |
|
|
|
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) |
|
|
|
importer.import_data(0) |
|
|
|
s1 = SamplePath(importer) |
|
|
|
s1 = SamplePath(importer) |
|
|
|
self.assertIsNone(s1.trajectories) |
|
|
|
self.assertIsNone(s1.trajectories) |
|
|
@ -36,14 +36,14 @@ class TestSamplePath(unittest.TestCase): |
|
|
|
self.assertIsNone(s1._total_variables_count) |
|
|
|
self.assertIsNone(s1._total_variables_count) |
|
|
|
|
|
|
|
|
|
|
|
def test_build_trajectories(self): |
|
|
|
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) |
|
|
|
importer.import_data(0) |
|
|
|
s1 = SamplePath(importer) |
|
|
|
s1 = SamplePath(importer) |
|
|
|
s1.build_trajectories() |
|
|
|
s1.build_trajectories() |
|
|
|
self.assertIsInstance(s1.trajectories, Trajectory) |
|
|
|
self.assertIsInstance(s1.trajectories, Trajectory) |
|
|
|
|
|
|
|
|
|
|
|
def test_build_structure(self): |
|
|
|
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) |
|
|
|
importer.import_data(0) |
|
|
|
s1 = SamplePath(importer) |
|
|
|
s1 = SamplePath(importer) |
|
|
|
s1.build_structure() |
|
|
|
s1.build_structure() |
|
|
@ -51,7 +51,7 @@ class TestSamplePath(unittest.TestCase): |
|
|
|
self.assertEqual(s1._total_variables_count, len(s1._importer.sorter)) |
|
|
|
self.assertEqual(s1._total_variables_count, len(s1._importer.sorter)) |
|
|
|
|
|
|
|
|
|
|
|
def test_build_structure_bad_sorter(self): |
|
|
|
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) |
|
|
|
importer.import_data(0) |
|
|
|
s1 = SamplePath(importer) |
|
|
|
s1 = SamplePath(importer) |
|
|
|
importer._sorter[0],importer._sorter[1]= importer._sorter[1],importer._sorter[0] |
|
|
|
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) |
|
|
|
self.assertRaises(RuntimeError, s1.build_structure) |
|
|
|
|
|
|
|
|
|
|
|
def test_build_saplepath_no_prior_net_structure(self): |
|
|
|
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.import_data(0) |
|
|
|
importer._df_structure = None |
|
|
|
importer._df_structure = None |
|
|
|
s1 = SamplePath(importer) |
|
|
|
s1 = SamplePath(importer) |
|
|
@ -68,13 +68,13 @@ class TestSamplePath(unittest.TestCase): |
|
|
|
self.assertFalse(s1.structure.edges) |
|
|
|
self.assertFalse(s1.structure.edges) |
|
|
|
|
|
|
|
|
|
|
|
def test_buid_samplepath_no_variables(self): |
|
|
|
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.import_data(0) |
|
|
|
importer._df_variables = None |
|
|
|
importer._df_variables = None |
|
|
|
self.assertRaises(RuntimeError, SamplePath, importer) |
|
|
|
self.assertRaises(RuntimeError, SamplePath, importer) |
|
|
|
|
|
|
|
|
|
|
|
def test_buid_samplepath_no_concatenated_samples(self): |
|
|
|
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.import_data(0) |
|
|
|
importer._concatenated_samples = None |
|
|
|
importer._concatenated_samples = None |
|
|
|
self.assertRaises(RuntimeError, SamplePath, importer) |
|
|
|
self.assertRaises(RuntimeError, SamplePath, importer) |
|
|
|