21 lines
612 B
Python
21 lines
612 B
Python
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
from yuxi.channel.channels._registry import get_compat_registry, register_channel
|
||
|
|
|
||
|
|
|
||
|
|
class TestCompatRegistry:
|
||
|
|
def test_register_and_get(self) -> None:
|
||
|
|
class FakeAdapter:
|
||
|
|
pass
|
||
|
|
|
||
|
|
register_channel("test_channel", FakeAdapter)
|
||
|
|
registry = get_compat_registry()
|
||
|
|
assert "test_channel" in registry
|
||
|
|
assert registry["test_channel"] is FakeAdapter
|
||
|
|
|
||
|
|
def test_get_compat_registry_returns_copy(self) -> None:
|
||
|
|
r1 = get_compat_registry()
|
||
|
|
r2 = get_compat_registry()
|
||
|
|
assert r1 is not r2
|
||
|
|
assert r1 == r2
|