def setUpClass(cls): with open(os.path.join(test_dir, "dump.rdx_wc.100")) as f: rdx_str = f.read() cls.rdx = LammpsDump.from_string(string=rdx_str) with open(os.path.join(test_dir, "dump.tatb")) as f: tatb_str = f.read() cls.tatb = LammpsDump.from_string(string=tatb_str)
def setUpClass(cls): with open(os.path.join(test_dir, "dump.rdx_wc.100")) as f: rdx_str = f.read() cls.rdx = LammpsDump.from_string(string=rdx_str) with open(os.path.join(test_dir, "dump.tatb")) as f: tatb_str = f.read() cls.tatb = LammpsDump.from_string(string=tatb_str)
def test_json_dict(self): encoded = json.dumps(self.rdx.as_dict()) decoded = json.loads(encoded) rdx = LammpsDump.from_dict(decoded) self.assertEqual(rdx.timestep, 100) self.assertEqual(rdx.natoms, 21) np.testing.assert_array_equal(rdx.box.bounds, np.array([(35, 48)] * 3)) pd.testing.assert_frame_equal(rdx.data, self.rdx.data)
def test_json_dict(self): encoded = json.dumps(self.rdx.as_dict()) decoded = json.loads(encoded) rdx = LammpsDump.from_dict(decoded) self.assertEqual(rdx.timestep, 100) self.assertEqual(rdx.natoms, 21) np.testing.assert_array_equal(rdx.box.bounds, np.array([(35, 48)] * 3)) pd.testing.assert_frame_equal(rdx.data, self.rdx.data)