def test_Many_obj(self): """Multiple pass test writing and retrieving data from a file using datetime obj.""" try: os.unlink(self.__tmpfile) except: pass with TimestampRecord(self.__tmpfile) as obj: [[[obj.set(c[0], c[1], c[2], self.__now) for c in b] for b in a] for a in self.__fixture] obj = TimestampRecord(self.__tmpfile) [[[self.assertEqual(self.__now.isoformat(),obj.get(c[0], c[1], c[2]).isoformat()) for c in b] for b in a] for a in self.__fixture]
def test_LastSuccessfulCheck_obj(self): """Single pass test writing and retrieving data from a file using datetime object.""" try: os.unlink(self.__tmpfile) except: pass with TimestampRecord(self.__tmpfile) as obj: obj.set('unstable', 'sparc', 'SunOS5.10', self.__now) obj = TimestampRecord(self.__tmpfile) self.assertEqual(self.__now.isoformat(), obj.get('unstable', 'sparc', 'SunOS5.10').isoformat())
def test_LastSuccessfulCheck_str(self): """Single pass test writing and retrieving data from a file using string date.""" try: os.unlink(self.__tmpfile) except: pass # With statement used to make sure data is saved to disk with TimestampRecord(self.__tmpfile) as obj: obj.set('unstable', 'sparc', 'SunOS5.10', self.__now.isoformat()) obj = TimestampRecord(self.__tmpfile) self.assertEqual(self.__now.isoformat(), obj.get('unstable', 'sparc', 'SunOS5.10').isoformat())
def test_Many_obj(self): """Multiple pass test writing and retrieving data from a file using datetime obj.""" try: os.unlink(self.__tmpfile) except: pass with TimestampRecord(self.__tmpfile) as obj: [[[obj.set(c[0], c[1], c[2], self.__now) for c in b] for b in a] for a in self.__fixture] obj = TimestampRecord(self.__tmpfile) [[[ self.assertEqual(self.__now.isoformat(), obj.get(c[0], c[1], c[2]).isoformat()) for c in b ] for b in a] for a in self.__fixture]