def test_wrapping_exception(self): p = IProperty(True, checks=('{t1} is True; {t2} == False', None)) # Wrapping function f = lambda s, o, v: 'test' with raises(ValueError): p._wrap_with_checker(f, None)
def test_wrapping_exception(self): p = IProperty(True, checks=('{t1} is True; {t2} == False', None)) # Wrapping function f = lambda s, o, v: 'test' with raises(ValueError): p._wrap_with_checker(f, None)
def test_wrapping_set_no_checker(self): p = IProperty(True, checks=('{t1} is True; {t2} == False', None)) # Wrapping function f = lambda s, o, v: 'test' p._wrap_with_checker(f, 'pre_set') assert p.pre_set.__func__ is f # Wrapping method f = MethodType(lambda s, o, v: 'test', p) p._wrap_with_checker(f, 'pre_set') assert p.pre_set is f
def test_wrapping_set_no_checker(self): p = IProperty(True, checks=('{t1} is True; {t2} == False', None)) # Wrapping function f = lambda s, o, v: 'test' p._wrap_with_checker(f, 'pre_set') assert p.pre_set.__func__ is f # Wrapping method f = MethodType(lambda s, o, v: 'test', p) p._wrap_with_checker(f, 'pre_set') assert p.pre_set is f
def test_wrapping_set_checker_exists(self): p = IProperty(True, checks='{t1} is True; {t2} == False') # Wrapping function f = lambda s, o, v: 'test' p._wrap_with_checker(f, 'pre_set') assert p.pre_set.__func__ is not f assert p.pre_set(self.t, None) == 'test' # Wrapping method f = MethodType(lambda s, o, v: 'test', p) p._wrap_with_checker(f, 'pre_set') assert p.pre_set is not f assert p.pre_set(self.t, None) == 'test'
def test_wrapping_set_checker_exists(self): p = IProperty(True, checks='{t1} is True; {t2} == False') # Wrapping function f = lambda s, o, v: 'test' p._wrap_with_checker(f, 'pre_set') assert p.pre_set.__func__ is not f assert p.pre_set(self.t, None) == 'test' # Wrapping method f = MethodType(lambda s, o, v: 'test', p) p._wrap_with_checker(f, 'pre_set') assert p.pre_set is not f assert p.pre_set(self.t, None) == 'test'