File: field_test.py

package info (click to toggle)
pyrsistent 0.20.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 688 kB
  • sloc: python: 5,289; ansic: 1,213; makefile: 8
file content (23 lines) | stat: -rw-r--r-- 422 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
from enum import Enum

from pyrsistent import field, pvector_field


class ExampleEnum(Enum):
    x = 1
    y = 2


def test_enum():
    f = field(type=ExampleEnum)

    assert ExampleEnum in f.type
    assert len(f.type) == 1


# This is meant to exercise `_seq_field`.
def test_pvector_field_enum_type():
    f = pvector_field(ExampleEnum)

    assert len(f.type) == 1
    assert ExampleEnum is list(f.type)[0].__type__