def test_String(self):
     p = String()
     with pytest.raises(ValueError) as e:
         p.validate(10)
     assert matches(
         str(e.value),
         r"expected a value of type (str|basestring), got 10 of type int")
예제 #2
0
 def test_String(self, detail):
     p = String()
     with pytest.raises(ValueError) as e:
         p.validate(10, detail)
     assert str(e).endswith("ValueError") == (not detail)
예제 #3
0
 def test_String(self):
     p = String()
     with pytest.raises(ValueError) as e:
         p.validate(10)
     assert not str(e).endswith("ValueError")
예제 #4
0
 def test_String(self, detail) -> None:
     p = String()
     with pytest.raises(ValueError) as e:
         p.validate(10, detail)
     assert (str(e.value) == "") == (not detail)
예제 #5
0
 def test_String(self, detail):
     p = String()
     with pytest.raises(ValueError) as e:
         p.validate(10, detail)
     assert str(e).endswith("ValueError") == (not detail)
예제 #6
0
 def test_String(self):
     p = String()
     with pytest.raises(ValueError) as e:
         p.validate(10)
     assert not str(e).endswith("ValueError")