Files
facefusion/tests/test_content_store.py
T
Henry Ruhs 1362afa8b7 content store (#1225)
* introduce content store for content analyser

* introduce content store for content analyser part2

* guard content store as well

* minor changes

* minor changes

* minor changes
2026-08-27 11:23:18 +02:00

44 lines
606 B
Python

import pytest
from facefusion.content_store import calculate_rate, clear, get_hit, set_hit, tick
@pytest.fixture(scope = 'function', autouse = True)
def before_each() -> None:
clear()
def test_get_hit() -> None:
assert get_hit() == 0
set_hit()
assert get_hit() == 1
def test_set_hit() -> None:
set_hit()
set_hit()
assert get_hit() == 2
def test_get_rate() -> None:
assert calculate_rate() == 0.0
for _ in range(100):
tick()
set_hit()
assert calculate_rate() == 30.0
def test_clear() -> None:
tick()
set_hit()
clear()
assert get_hit() == 0
assert calculate_rate() == 0.0