File: conftest.py

package info (click to toggle)
python-async-lru 2.0.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 208 kB
  • sloc: python: 904; makefile: 17
file content (28 lines) | stat: -rw-r--r-- 621 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from functools import _CacheInfo
from typing import Callable

import pytest

from async_lru import _R, _LRUCacheWrapper


@pytest.fixture
def check_lru() -> Callable[..., None]:
    def _check_lru(
        wrapped: _LRUCacheWrapper[_R],
        *,
        hits: int,
        misses: int,
        cache: int,
        tasks: int,
        maxsize: int = 128
    ) -> None:
        assert wrapped.cache_info() == _CacheInfo(
            hits=hits,
            misses=misses,
            maxsize=maxsize,
            currsize=cache,
        )
        assert wrapped.cache_parameters()["tasks"] == tasks

    return _check_lru