Beispiel #1
0
def test_print_cache(capfd):
    clear_cache()
    _identity(x)
    info = _identity.cache_info()
    print_cache()
    resout, _ = capfd.readouterr()
    assert resout.find('_identity ' + str(info)) >= 0
Beispiel #2
0
def test_print_cache(capfd):
    clear_cache()
    _identity(x)
    info = _identity.cache_info()
    print_cache()
    resout, _ = capfd.readouterr()
    assert resout.find('_identity ' + str(info)) >= 0
Beispiel #3
0
def test_print_cache(capfd):
    clear_cache()
    wrapped = _identity.__wrapped__
    _identity(x)
    item = str(wrapped)
    head = '='*len(item)
    res = (head + "\n" + item + "\n" + head + "\n" +
           "  ((Symbol('x'), <class 'diofant.core.symbol.Symbol'>), (True,)) : x\n")
    print_cache()
    resout, _ = capfd.readouterr()
    assert resout == res
    assert dict(CACHE)[wrapped] == {((x, Symbol), (True,)): x}