コード例 #1
0
ファイル: test_inputs.py プロジェクト: rheehot/sanic-restplus
 def test_schema(self):
     assert inputs.regex(r'^[0-9]+$').__schema__ == {
         'type': 'string',
         'pattern': '^[0-9]+$'
     }
コード例 #2
0
ファイル: test_inputs.py プロジェクト: rheehot/sanic-restplus
 def test_bad_input(self, value):
     num_only = inputs.regex(r'^[0-9]+$')
     with pytest.raises(ValueError):
         num_only(value)
コード例 #3
0
ファイル: test_inputs.py プロジェクト: rheehot/sanic-restplus
 def test_bad_pattern(self):
     with pytest.raises(re.error):
         inputs.regex('[')
コード例 #4
0
ファイル: test_inputs.py プロジェクト: rheehot/sanic-restplus
 def test_valid_input(self, value):
     num_only = inputs.regex(r'^[0-9]+$')
     assert num_only(value) == value