コード例 #1
0
 def test_type_error(self):
     with pytest.raises(TypeError):
         validate('arg', 1.5)
コード例 #2
0
 def test_max_custom_err_msg(self):
     with pytest.raises(ValueError) as ex:
         validate('arg', 10, 1, 5, custom_max_message='custom')
     assert str(ex.value) == 'custom'
コード例 #3
0
 def test_valid(self):
     validate('arg', 10, 0, 20, 'custom min msg', 'custom max msg')
コード例 #4
0
 def test_max_std_err_msg(self):
     with pytest.raises(ValueError) as ex:
         validate('arg', 10, 1, 5)
     assert 'arg' in str(ex.value)
     assert '5' in str(ex.value)