def test_motl_csv_not_in_path(self): sys.argv = [ "something", "-motl", "emd_3465.map", "blabla.csv", "--tomogram-map-file", "emd_3464.map" ] with self.assertRaises(ValueError): cm.main()
def test_map_not_in_path(self): sys.argv = [ "something", "-dynamo", "emd_1305_averaged.em", "emd_1305_averaged.tbl", "--tomogram-map-file", "blabla.map" ] with self.assertRaises(ValueError): cm.main()
def test_tbl_not_in_path(self): """Test whether the system raises ValueError if the given .tbl file does not exist in the path""" sys.argv = [ "something", "-dynamo", "emd_1305_averaged.em", "blabla.tbl", "--tomogram-map-file", "emd_1305.map" ] with self.assertRaises(ValueError): cm.main()
def test_calls_create_output_function(self): """Test if main() is executed, create_output() is run""" sys.argv = [ "something", "-dynamo", "emd_1305_averaged.em", "emd_1305_averaged.tbl", "--tomogram-map-file", "emd_1305.map", "-o", "rm_5.txt" ] cm.main() self.assertTrue(os.path.exists("rm_5.txt")) os.remove("rm_5.txt")
def test_which_create_output(self): """Test if the correct function is called""" captured_output = io.StringIO() sys.stdout = captured_output sys.argv = [ "something", "-dynamo", "emd_1305_averaged.em", "emd_1305_averaged.tbl", "--tomogram-map-file", "emd_1305.map", "--output", "rm_4.txt" ] cm.main() os.path.exists("rm_4.txt") os.remove("rm_4.txt") self.assertTrue( "Source file from Dynamo" in captured_output.getvalue()) sys.argv = [ "something", "-motl", "emd_3465.map", "tests/motl_1_1t.csv", "--tomogram-map-file", "emd_3464.map", "--output", "rm_4.txt" ] cm.main() os.remove("rm_4.txt") self.assertTrue( "Source file from Brigg's lab" in captured_output.getvalue())