def test_cache_size_leq_max_cache_size(config_stub, tmpdir):
 limit = 100
 config_stub.data = {'storage': {'cache-size': limit}, 'general': {'private-browsing': False}}
 disk_cache = cache.DiskCache(str(tmpdir))
 assert (disk_cache.maximumCacheSize() == limit)
 preload_cache(disk_cache, 'http://www.example.com/')
 preload_cache(disk_cache, 'http://qutebrowser.org')
 preload_cache(disk_cache, 'http://foo.xxx')
 preload_cache(disk_cache, 'http://bar.net')
 assert (disk_cache.expire() < limit)
 assert (disk_cache.cacheSize() < (limit + 100))

def test_cache_size_leq_max_cache_size ( config_stub , tmpdir ) : limit = 100 config_stub . data = { 'storage' : { 'cache-size' : limit } , 'general' : { 'private-browsing' : False } } disk_cache = cache . DiskCache ( str ( tmpdir ) ) assert ( disk_cache . maximumCacheSize ( ) == limit ) preload_cache ( disk_cache , 'http://www.example.com/' ) preload_cache ( disk_cache , 'http://qutebrowser.org' ) preload_cache ( disk_cache , 'http://foo.xxx' ) preload_cache ( disk_cache , 'http://bar.net' ) assert ( disk_cache . expire ( ) < limit ) assert ( disk_cache . cacheSize ( ) < ( limit + 100 ) )
test cachesize <= maximumcachesize when cache is activated .