示例#1
0
文件: test.py 项目: TadLeonard/enumap
def test_member_types():
    Pastry = Enumap("Pastry", names="croissant donut muffin")
    Pastry.set_types(int, int, int, donut=float)  # override donut with kwarg
    assert (Pastry.types() ==
            {'croissant': int, 'donut': float, 'muffin': int})
示例#2
0
文件: test.py 项目: TadLeonard/enumap
def test_typless():
    """Make sure types are allowed to be blank"""
    a = Enumap("A", "a b c".split())
    b = SparseEnumap("B", "a b c".split())
    assert a.types() == {}
    assert b.types() == {}