示例#1
0
 def test_big_number(self):
     with self.assertRaises(ValidationError):
         validators.hour_validator('24')
     with self.assertRaises(ValidationError):
         validators.hour_validator('420')
     with self.assertRaises(ValidationError):
         validators.hour_validator('100500')
示例#2
0
 def test_text(self):
     with self.assertRaises(ValidationError):
         validators.hour_validator('fsd')
     with self.assertRaises(ValidationError):
         validators.hour_validator('.')
     with self.assertRaises(ValidationError):
         validators.hour_validator('432a')
示例#3
0
 def test_bad_slice(self):
     with self.assertRaises(ValidationError):
         validators.hour_validator('*/100')
     with self.assertRaises(ValidationError):
         validators.hour_validator('10/30')
     with self.assertRaises(ValidationError):
         validators.hour_validator('10-20/100')
示例#4
0
 def test_out_range(self):
     with self.assertRaises(ValidationError):
         validators.hour_validator('0-24')
     with self.assertRaises(ValidationError):
         validators.hour_validator('342-432')
     with self.assertRaises(ValidationError):
         validators.hour_validator('4-25')
 def test_bad_slice(self):
     with self.assertRaises(ValidationError):
         validators.hour_validator('*/100')
     with self.assertRaises(ValidationError):
         validators.hour_validator('10/30')
     with self.assertRaises(ValidationError):
         validators.hour_validator('10-20/100')
 def test_big_number(self):
     with self.assertRaises(ValidationError):
         validators.hour_validator('24')
     with self.assertRaises(ValidationError):
         validators.hour_validator('420')
     with self.assertRaises(ValidationError):
         validators.hour_validator('100500')
 def test_out_range(self):
     with self.assertRaises(ValidationError):
         validators.hour_validator('0-24')
     with self.assertRaises(ValidationError):
         validators.hour_validator('342-432')
     with self.assertRaises(ValidationError):
         validators.hour_validator('4-25')
 def test_text(self):
     with self.assertRaises(ValidationError):
         validators.hour_validator('fsd')
     with self.assertRaises(ValidationError):
         validators.hour_validator('.')
     with self.assertRaises(ValidationError):
         validators.hour_validator('432a')
示例#9
0
 def test_space(self):
     with self.assertRaises(ValidationError):
         validators.hour_validator('1, 2')
示例#10
0
    def test_good(self):
        try:
            validators.hour_validator('*')
            validators.hour_validator('0')
            validators.hour_validator('1')
            validators.hour_validator('22')
            validators.hour_validator('23')

            validators.hour_validator('1,2,23')
            validators.hour_validator('23,2')
            validators.hour_validator('5,20,21,22')

            validators.hour_validator('1-4')
            validators.hour_validator('1-23')

            validators.hour_validator('*/4')
            validators.hour_validator('*/22')
            validators.hour_validator('1-2/5')
        except ValidationError as e:
            self.fail(e)
示例#11
0
 def test_bad_range(self):
     with self.assertRaises(ValidationError):
         validators.hour_validator('10-4')
示例#12
0
 def test_space(self):
     with self.assertRaises(ValidationError):
         validators.hour_validator('1, 2')
示例#13
0
    def test_good(self):
        try:
            validators.hour_validator('*')
            validators.hour_validator('0')
            validators.hour_validator('1')
            validators.hour_validator('22')
            validators.hour_validator('23')

            validators.hour_validator('1,2,23')
            validators.hour_validator('23,2')
            validators.hour_validator('5,20,21,22')

            validators.hour_validator('1-4')
            validators.hour_validator('1-23')

            validators.hour_validator('*/4')
            validators.hour_validator('*/22')
            validators.hour_validator('1-2/5')
        except ValidationError as e:
            self.fail(e)
示例#14
0
 def test_bad_range(self):
     with self.assertRaises(ValidationError):
         validators.hour_validator('10-4')