예제 #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')
예제 #5
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')
예제 #6
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')
예제 #7
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')
예제 #8
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')
예제 #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')