示例#1
0
def test_cache_function_works_after_cleanup():
    first = func()
    clear_cache(func)
    second = func()
    third = func()
    assert first != second
    assert second == third
示例#2
0
def test_cache_function_works_after_cleanup():
    first = func()
    clear_cache(func)
    second = func()
    third = func()
    assert first != second
    assert second == third
示例#3
0
def test_cached_method_kwargs(subject):
    clear_cache(subject)
    assert subject.cached_method_3(value=1) == 1
    assert subject.cached_method_3(value=1) == 1
    assert subject.cached_method_3(value=2) == 2
    assert subject.cached_method_3(value=2) == 2
    with ignoring_cache():
        assert subject.cached_method_3(value=1) == 3
        assert subject.cached_method_3(value=2) == 4
    assert subject.cached_method_3(value=1) == 3
    assert subject.cached_method_3(value=2) == 4
示例#4
0
def test_cached_method_no_args_and_kwargs(subject):
    clear_cache(subject)
    assert subject.cached_method_4() == 1
    assert subject.prop == 2
    assert subject.cached_method_4() == 1
    clear_cache(subject)
示例#5
0
def test_cached_method_mutable_kwargs(subject):
    clear_cache(subject)
    assert subject.cached_method_3(value=[1]) == 1
    assert subject.cached_method_3(value=[1]) == 2
示例#6
0
def test_cached_method_clear_cache(subject):
    assert subject.cached_method_1(1) == 1
    assert subject.cached_method_1(1) == 1
    clear_cache(subject)
    assert subject.cached_method_1(1) == 2
示例#7
0
def test_cache_function_clear_cache_works():
    before = func()
    clear_cache(func)
    after = func()
    assert before != after
示例#8
0
def test_subject_clear_cache(subject):
    assert subject.prop == 1
    clear_cache(subject)
    assert subject.prop == 2
示例#9
0
def test_cached_method_no_args_and_kwargs(subject):
    clear_cache(subject)
    assert subject.cached_method_4() == 1
    assert subject.prop == 2
    assert subject.cached_method_4() == 1
    clear_cache(subject)
示例#10
0
def test_cached_method_mutable_kwargs(subject):
    clear_cache(subject)
    assert subject.cached_method_3(value=[1]) == 1
    assert subject.cached_method_3(value=[1]) == 2
示例#11
0
def test_cached_method_kwargs(subject):
    clear_cache(subject)
    assert subject.cached_method_3(value=1) == 1
    assert subject.cached_method_3(value=1) == 1
    assert subject.cached_method_3(value=2) == 2
    assert subject.cached_method_3(value=2) == 2
示例#12
0
def test_cached_method_args(subject):
    clear_cache(subject)
    assert subject.cached_method_3(1) == 1
    assert subject.cached_method_3(1) == 1
    assert subject.cached_method_3(2) == 2
    assert subject.cached_method_3(2) == 2
示例#13
0
def test_cached_method_clear_cache(subject):
    assert subject.cached_method_1(1) == 1
    assert subject.cached_method_1(1) == 1
    clear_cache(subject)
    assert subject.cached_method_1(1) == 2
示例#14
0
def test_cache_function_clear_cache_works():
    before = func()
    clear_cache(func)
    after = func()
    assert before != after
示例#15
0
def test_subject_clear_cache(subject):
    assert subject.prop == 1
    clear_cache(subject)
    assert subject.prop == 2