예제 #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