def test_val_in_list(self): cont = [1, 2, 3, 4] func = validators.one_of(cont) assert func(1) == 1
def test_val_not_in_list(self): cont = [1, 2, 3, 4] func = validators.one_of(cont) raises_Invalid(func)(5)
def test_empty_val_accepted(self): cont = [1, 2, 3, 4] func = validators.one_of(cont) assert func("") == ""