Changeset 4272
- Timestamp:
- Feb 21, 2007, 9:45:58 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/caching/test_caching.py
r3715 r4272 20 20 return(B) 21 21 22 23 24 25 26 22 class Dummy: 23 def __init__(self,value, another): 24 self.value = value 27 25 28 26 class Test_Caching(unittest.TestCase): … … 300 298 301 299 300 def Will_fail_test_objects(self): 301 """ 302 This test shows how instances can't be effectively cached. 303 myhash uses hash which uses id which uses the memory address. 304 """ 305 verbose = True 306 verbose = False 307 308 for i in range(2): 309 if verbose: print "clear cache" 310 a = cache(Dummy,'clear') 311 if verbose: print "cache for first time" 312 a = cache(Dummy,args=(9,10) ,verbose=verbose) 313 hash_value = myhash(a) 314 #print "hash_value",hash_value 315 if verbose: print "cache for second time" 316 a = cache(Dummy,args=(9,10) ,verbose=verbose) 317 #print "myhash(a)",myhash(a) 318 assert hash_value == myhash(a) 319 320 321 302 322 303 323
Note: See TracChangeset
for help on using the changeset viewer.