def test_cache(): """Test the compiler correctly compiles and caches inputs """ cp = compilerop.CachingCompiler() ncache = len(linecache.cache) cp.cache('x=1') assert len(linecache.cache) > ncache
def test_compiler(): """Test the compiler correctly compiles and caches inputs """ cp = compilerop.CachingCompiler() ncache = len(linecache.cache) cp('x=1', 'single') nt.assert_true(len(linecache.cache) > ncache)
def test_compiler_check_cache(): """Test the compiler properly manages the cache. """ # Rather simple-minded tests that just exercise the API cp = compilerop.CachingCompiler() cp.cache('x=1', 99) # Ensure now that after clearing the cache, our entries survive linecache.checkcache() assert any( k.startswith("<ipython-input-99") for k in linecache.cache), "Entry for input-99 missing from linecache"
def test_compiler_check_cache(): """Test the compiler properly manages the cache. """ # Rather simple-minded tests that just exercise the API cp = compilerop.CachingCompiler() cp.cache('x=1', 99) # Ensure now that after clearing the cache, our entries survive linecache.checkcache() for k in linecache.cache: if k.startswith('<ipython-input-99'): break else: raise AssertionError('Entry for input-99 missing from linecache')
def test_cache_unicode(): cp = compilerop.CachingCompiler() ncache = len(linecache.cache) cp.cache(u"t = 'žćčšđ'") assert len(linecache.cache) > ncache
def test_cache_unicode(): cp = compilerop.CachingCompiler() ncache = len(linecache.cache) cp.cache("t = 'žćčšđ'") nt.assert_true(len(linecache.cache) > ncache)
def test_compiler_unicode(): cp = compilerop.CachingCompiler() ncache = len(linecache.cache) cp(u"t = 'žćčšđ'", "single") nt.assert_true(len(linecache.cache) > ncache)