MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_lru_cache_threaded3

Method test_lru_cache_threaded3

Lib/test/test_functools.py:1998–2008  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1996
1997 @threading_helper.requires_working_threading()
1998 def test_lru_cache_threaded3(self):
1999 @self.module.lru_cache(maxsize=2)
2000 def f(x):
2001 time.sleep(.01)
2002 return 3 * x
2003 def test(i, x):
2004 self.assertEqual(f(x), 3 * x, i)
2005 threads = [threading.Thread(target=test, args=(i, v))
2006 for i, v in enumerate([1, 2, 2, 3, 2])]
2007 with threading_helper.start_threads(threads):
2008 pass
2009
2010 def test_need_for_rlock(self):
2011 # This will deadlock on an LRU cache that uses a regular lock

Callers

nothing calls this directly

Calls 1

enumerateFunction · 0.85

Tested by

no test coverage detected