def has_feature(featurebits: List[int], event: Event, msg: Message, runner: 'Runner') -> None: for bit in featurebits: if not has_bit(msg.fields['features'], bit): raise EventError( event, "features set bit {} unset: {}".format(bit, msg.to_str()))
def has_one_feature(featurebits: List[int], event: Event, msg: Message, runner: 'Runner') -> None: has_any = False for bit in featurebits: if has_bit(msg.fields['features'], bit): has_any = True if not has_any: raise EventError( event, "none of {} set: {}".format(featurebits, msg.to_str()))
def no_feature(featurebits: List[int], event: Event, msg: Message) -> None: for bit in featurebits: if has_bit(msg.fields['features'], bit): raise EventError( event, "features set bit {} unexpected: {}".format(bit, msg.to_str()))