File: test_messages.py

package info (click to toggle)
python-pykka 4.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 520 kB
  • sloc: python: 2,817; makefile: 113
file content (31 lines) | stat: -rw-r--r-- 903 bytes parent folder | download | duplicates (3)
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
29
30
31
from pykka.messages import ProxyCall, ProxyGetAttr, ProxySetAttr, _ActorStop


def test_actor_stop() -> None:
    message = _ActorStop()

    assert isinstance(message, _ActorStop)


def test_proxy_call() -> None:
    message = ProxyCall(attr_path=("nested", "method"), args=(1,), kwargs={"a": "b"})

    assert isinstance(message, ProxyCall)
    assert message.attr_path == ("nested", "method")
    assert message.args == (1,)
    assert message.kwargs == {"a": "b"}


def test_proxy_get_attr() -> None:
    message = ProxyGetAttr(attr_path=("nested", "attr"))

    assert isinstance(message, ProxyGetAttr)
    assert message.attr_path == ("nested", "attr")


def test_proxy_set_attr() -> None:
    message = ProxySetAttr(attr_path=("nested", "attr"), value="abcdef")

    assert isinstance(message, ProxySetAttr)
    assert message.attr_path == ("nested", "attr")
    assert message.value == "abcdef"