mirror of
https://github.com/facefusion/facefusion.git
synced 2026-09-15 20:15:28 +02:00
* introduce content store for content analyser * introduce content store for content analyser part2 * guard content store as well * minor changes * minor changes * minor changes
44 lines
606 B
Python
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
|