Files
crypto_monitor/tests/test_instance_live_push_lib.py
T
dekun b733e551a0 Normalize fullwidth punctuation to ASCII across codebase.
Add scripts/normalize_ambiguous_unicode.py; fix corrupted patch_instance_theme_templates.py. Preserves curly quotes in string literals; removes Git homoglyph warnings on .env.example.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-08 23:42:26 +08:00

21 lines
546 B
Python

"""instance_live_push_lib 单元测试."""
from __future__ import annotations
import json
from lib.instance.instance_live_push_lib import InstanceLivePush
def test_tick_increments_version_and_connect_event() -> None:
push = InstanceLivePush()
v1 = push.tick("test")
v2 = push.tick("test")
assert v1 == 1
assert v2 == 2
gen = push.iter_sse()
first = next(gen)
assert first.startswith("event: live")
data = json.loads(first.split("data: ", 1)[1].strip())
assert data["live_version"] == 2
push.stop()