예제 #1
0
 def __init__(self, name, min_=None, max_=None,
              default=None, optional=False):
     super(Integer, self).__init__(
         name,
         optional,
         default,
         validate.Int(min_, max_)
     )
예제 #2
0
 def test_int(self):
     inputs = [1, 30, 30.09, '20']
     i = vals.Int()
     for input in inputs:
         i(input)
예제 #3
0
 def test_int_min_max_fail(self):
     inputs = [2, 10, 33, 45.09]
     i = vals.Int(min_=20, max_=30)
     for input in inputs:
         i(input)
예제 #4
0
 def test_int_max_zero_fail(self):
     inputs = [15, 30.09]
     i = vals.Int(max_=0)
     for input in inputs:
         i(input)
예제 #5
0
 def test_int_min_zero_fail(self):
     inputs = [-1, -10]
     i = vals.Int(min_=0)
     for input in inputs:
         i(input)
예제 #6
0
 def test_int_min_fail(self):
     inputs = [1, 30, 30.09]
     i = vals.Int(min_=40)
     for input in inputs:
         i(input)
예제 #7
0
 def test_int_fail(self):
     inputs = ["1.a", datetime.datetime.now()]
     i = vals.Int()
     for input in inputs:
         i(input)
예제 #8
0
 def test_int_min_max(self):
     inputs = [2, 30, 30.09]
     i = vals.Int(min_=1, max_=30)
     for input in inputs:
         i(input)
예제 #9
0
 def test_int_max(self):
     inputs = [1, 30, 30.09]
     i = vals.Int(max_=30)
     for input in inputs:
         i(input)