def test_bool_by_mask(): class MaskObject(object): def __init__(self): self.TEST_MASK_1 = False self.TEST_MASK_2 = True m = MaskObject() assert_is(True, get_bool_by_mask(m, "ABC")) assert_is(False, get_bool_by_mask(m, "TEST_MASK")) assert_is(False, get_bool_by_mask(m, "TEST_MASK_1")) assert_is(True, get_bool_by_mask(m, "TEST_MASK_2")) set_by_mask(m, "TEST_", True) assert_is(True, get_bool_by_mask(m, "TEST_MASK")) assert_is(True, get_bool_by_mask(m, "TEST_MASK_1")) assert_is(True, get_bool_by_mask(m, "TEST_MASK_2")) set_by_mask(m, "TEST_MASK_2", False) assert_is(True, get_bool_by_mask(m, "ABC")) assert_is(False, get_bool_by_mask(m, "TEST_MASK")) assert_is(True, get_bool_by_mask(m, "TEST_MASK_1")) assert_is(False, get_bool_by_mask(m, "TEST_MASK_2"))
def DUMP_ALL(self, value=None): if value is None: return get_bool_by_mask(self, "DUMP_") set_by_mask(self, "DUMP_", value)
def test_bool_by_mask(): class MaskObject(object): def __init__(self): self.TEST_MASK_1 = False self.TEST_MASK_2 = True m = MaskObject() assert_is(True, get_bool_by_mask(m, 'ABC')) assert_is(False, get_bool_by_mask(m, 'TEST_MASK')) assert_is(False, get_bool_by_mask(m, 'TEST_MASK_1')) assert_is(True, get_bool_by_mask(m, 'TEST_MASK_2')) set_by_mask(m, 'TEST_', True) assert_is(True, get_bool_by_mask(m, 'TEST_MASK')) assert_is(True, get_bool_by_mask(m, 'TEST_MASK_1')) assert_is(True, get_bool_by_mask(m, 'TEST_MASK_2')) set_by_mask(m, 'TEST_MASK_2', False) assert_is(True, get_bool_by_mask(m, 'ABC')) assert_is(False, get_bool_by_mask(m, 'TEST_MASK')) assert_is(True, get_bool_by_mask(m, 'TEST_MASK_1')) assert_is(False, get_bool_by_mask(m, 'TEST_MASK_2'))