Example #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')
Example #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')
Example #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')
Example #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')
Example #9
0
 def test_space(self):
     with self.assertRaises(ValidationError):
         validators.hour_validator('1, 2')
Example #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)
Example #11
0
 def test_bad_range(self):
     with self.assertRaises(ValidationError):
         validators.hour_validator('10-4')
 def test_space(self):
     with self.assertRaises(ValidationError):
         validators.hour_validator('1, 2')
    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)
 def test_bad_range(self):
     with self.assertRaises(ValidationError):
         validators.hour_validator('10-4')