<s> import twitter <EOL> import unittest <EOL> import time <EOL> class FileCacheTest ( unittest . TestCase ) : <EOL> def testInit ( self ) : <EOL> """<STR_LIT>""" <EOL> cache = twitter . _FileCache ( ) <EOL> self . assert_ ( cache is not None , '<STR_LIT>' ) <EOL> def testSet ( self ) : <EOL> """<STR_LIT>""" <EOL> cache = twitter . _FileCache ( ) <EOL> cache . Set ( "<STR_LIT:foo>" , '<STR_LIT>' ) <EOL> cache . Remove ( "<STR_LIT:foo>" ) <EOL> def testRemove ( self ) : <EOL> """<STR_LIT>""" <EOL> cache = twitter . _FileCache ( ) <EOL> cache . Set ( "<STR_LIT:foo>" , '<STR_LIT>' ) <EOL> cache . Remove ( "<STR_LIT:foo>" ) <EOL> data = cache . Get ( "<STR_LIT:foo>" ) <EOL> self . assertEqual ( data , None , '<STR_LIT>' ) <EOL> def testGet ( self ) : <EOL> """<STR_LIT>""" <EOL> cache = twitter . _FileCache ( ) <EOL> cache . Set ( "<STR_LIT:foo>" , '<STR_LIT>' ) <EOL> data = cache . Get ( "<STR_LIT:foo>" ) <EOL> self . assertEqual ( '<STR_LIT>' , data ) <EOL> cache . Remove ( "<STR_LIT:foo>" ) <EOL> def testGetCachedTime ( self ) : <EOL> """<STR_LIT>""" <EOL> now = time . time ( ) <EOL> cache = twitter . _FileCache ( ) <EOL> cache . Set ( "<STR_LIT:foo>" , '<STR_LIT>' ) <EOL> cached_time = cache . GetCachedTime ( "<STR_LIT:foo>" ) <EOL> delta = cached_time - now <EOL> self . assert_ ( delta <= <NUM_LIT:1> , <EOL> '<STR_LIT>' ) <EOL> cache . Remove ( "<STR_LIT:foo>" ) </s>
