class SchedFileTest(ResTest): def setUp(self): src_file = self.createTestPath("Equinor/ECLIPSE/Gurbat/target.SCH") self.start_time = datetime.date(2000, 1, 1) self.sched_file = SchedFile(src_file, self.start_time) self.file_list = [] def test_missing(self): with self.assertRaises(IOError): SchedFile("/does/not/exist", datetime.date(2000, 1, 1)) def addFile(self, filename): self.file_list.append(filename) def tearDown(self): for f in self.file_list: if os.path.exists(f): os.unlink(f) def test_load(self): self.assertTrue(self.sched_file, "Load failed") def test_length(self): self.assertEqual(self.sched_file.length, 63) def test_write_loop(self): self.sched_file.write("/tmp/schedule1", 62) sched_file2 = SchedFile("/tmp/schedule1", self.start_time) sched_file2.write("/tmp/schedule2", 62) self.assertFilesAreEqual("/tmp/schedule1", "/tmp/schedule2") self.addFile("/tmp/schedule1") self.addFile("/tmp/schedule2")
def test_write_loop(self): self.sched_file.write("/tmp/schedule1", 62) sched_file2 = SchedFile("/tmp/schedule1", self.start_time) sched_file2.write("/tmp/schedule2", 62) self.assertFilesAreEqual("/tmp/schedule1", "/tmp/schedule2") self.addFile("/tmp/schedule1") self.addFile("/tmp/schedule2")
def test_missing(self): with self.assertRaises(IOError): SchedFile("/does/not/exist", datetime.date(2000 , 1 , 1))
def setUp(self): src_file = self.createTestPath("Statoil/ECLIPSE/Gurbat/target.SCH") self.start_time = datetime.date(2000, 1, 1) self.sched_file = SchedFile(src_file, self.start_time) self.file_list = []