def setUpClass(cls): cls.es_list = list() file_list = ["vasprun_1.xml", "vasprun_2.xml"] for f in file_list: vp = Vasprun() direc = os.path.abspath( os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../static/vasp_test_files/vasprun_samples")) filename = posixpath.join(direc, f) vp.from_file(filename) es = vp.get_electronic_structure() cls.es_list.append(es)
def setUp(self): self.es_list = list() file_list = ["vasprun_1.xml", "vasprun_2.xml"] for f in file_list: vp = Vasprun() self.assertIsInstance(vp.vasprun_dict, dict) direc = os.path.abspath( os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../static/vasprun_samples")) filename = posixpath.join(direc, f) vp.from_file(filename) es = vp.get_electronic_structure() self.es_list.append(es)
def setUpClass(cls): cls.file_location = os.path.dirname(os.path.abspath(__file__)) cls.vp_list = list() cls.direc = os.path.join(cls.file_location, "../static/vasp_test_files/vasprun_samples") file_list = sorted(os.listdir(cls.direc)) del file_list[file_list.index("vasprun_spoilt.xml")] cls.num_species = [3, 1, 2, 2, 3, 4, 2] for f in file_list: vp = Vasprun() filename = posixpath.join(cls.direc, f) vp.from_file(filename) cls.vp_list.append(vp)
def setUp(self): self.file_location = os.path.dirname(os.path.abspath(__file__)) self.vp_list = list() direc = os.path.join(self.file_location, "../static/vasp_test_files/vasprun_samples") file_list = sorted(os.listdir(direc)) del file_list[file_list.index("vasprun_spoilt.xml")] self.num_species = [3, 1, 2, 2, 3, 4] for f in file_list: vp = Vasprun() self.assertIsInstance(vp.vasprun_dict, dict) filename = posixpath.join(direc, f) vp.from_file(filename) self.vp_list.append(vp) vp = Vasprun() filename = posixpath.join(direc, "vasprun_spoilt.xml") self.assertRaises(VasprunError, vp.from_file, filename)
def test_from_file(self): vp = Vasprun() filename = posixpath.join(self.direc, "vasprun_spoilt.xml") self.assertRaises(VasprunError, vp.from_file, filename)