File: test_symbol.py

package info (click to toggle)
blinker 1.9.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 260 kB
  • sloc: python: 692; sh: 17; makefile: 10
file content (26 lines) | stat: -rw-r--r-- 503 bytes parent folder | download | duplicates (2)
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
from __future__ import annotations

import pickle

from blinker._utilities import Symbol


def test_symbols() -> None:
    foo = Symbol("foo")
    assert foo.name == "foo"
    assert foo is Symbol("foo")

    bar = Symbol("bar")
    assert foo is not bar
    assert foo != bar
    assert not foo == bar

    assert repr(foo) == "foo"


def test_pickled_symbols() -> None:
    foo = Symbol("foo")

    for _ in 0, 1, 2:
        roundtrip = pickle.loads(pickle.dumps(foo))
        assert roundtrip is foo