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
def test_bitflag_not_int_flag(flag): with pytest.raises(bitmask.InvalidBitFlag): bitmask.BitFlag((flag, 'custom flag'))
def test_bitflag_docs2(): with pytest.raises(ValueError): bitmask.BitFlag((1, 'docs1'), 'docs2')