Beispiel #1
0
def test_bitflag(flag):
    f = bitmask.BitFlag(flag)
    if isinstance(flag, tuple):
        assert f == flag[0]
        assert f.__doc__ == flag[1]

        f = bitmask.BitFlag(*flag)
        assert f == flag[0]
        assert f.__doc__ == flag[1]

    else:
        assert f == flag
Beispiel #2
0
def test_bitflag_not_int_flag(flag):
    with pytest.raises(bitmask.InvalidBitFlag):
        bitmask.BitFlag((flag, 'custom flag'))
Beispiel #3
0
def test_bitflag_docs2():
    with pytest.raises(ValueError):
        bitmask.BitFlag((1, 'docs1'), 'docs2')