def test_mtime(self): hw = 'Hello World!' zero = 0.0 #time.ctime(0) hub.set('test1', hw, mtime=zero) mtime = hub.mtime('test1') value = hub.get('test1') self.assert_(zero - mtime < 1.0) #disk acess is so slow. self.assertEqual(value, hw) try: value = hub.mtime('test2') except NotInCache: pass
def test_HelloWorld(self): hw = 'Hello World!' hub.set('test1', hw) now = time.time() mtime = hub.mtime('test1') value = hub.get('test1') self.assert_(now - mtime < 1.0) #disk acess is so slow. self.assertEqual(value, hw)
def test_HelloWorld(self): hw = 'Hello World!' hub.set('test1', hw) time.sleep(0.01) #wait for cache to be written value = hub.get('test1') mtime = hub.mtime('test1') now = time.time() self.assertAlmostEqual(now, mtime, 1) self.assertEqual(value, hw)
def test_HelloWorld(self): hw = 'Hello World!' hub.set('test1', hw) now = time.time() try: mtime = hub.mtime('test1') self.assert_(False) except NotInCache: pass try: value = hub.get('test1') self.assert_(False) except NotInCache: pass