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