Ejemplo n.º 1
0
 def test_schema(self):
     assert inputs.regex(r'^[0-9]+$').__schema__ == {
         'type': 'string',
         'pattern': '^[0-9]+$'
     }
Ejemplo n.º 2
0
 def test_bad_input(self, value):
     num_only = inputs.regex(r'^[0-9]+$')
     with pytest.raises(ValueError):
         num_only(value)
Ejemplo n.º 3
0
 def test_bad_pattern(self):
     with pytest.raises(re.error):
         inputs.regex('[')
Ejemplo n.º 4
0
 def test_valid_input(self, value):
     num_only = inputs.regex(r'^[0-9]+$')
     assert num_only(value) == value