Esempio n. 1
0
 def test_Regex(self) -> None:
     p = Regex("green")
     with pytest.raises(ValueError) as e:
         p.validate("junk")
     assert matches(
         str(e.value),
         r"expected a string matching 'green' pattern, got 'junk'")
Esempio n. 2
0
 def test_Regex(self, detail):
     p = Regex("green")
     with pytest.raises(ValueError) as e:
         p.validate("junk", detail)
     assert str(e).endswith("ValueError") == (not detail)
Esempio n. 3
0
 def test_Regex(self):
     p = Regex("green")
     with pytest.raises(ValueError) as e:
         p.validate("junk")
     assert not str(e).endswith("ValueError")
Esempio n. 4
0
 def test_Regex(self, detail) -> None:
     p = Regex("green")
     with pytest.raises(ValueError) as e:
         p.validate("junk", detail)
     assert (str(e.value) == "") == (not detail)
Esempio n. 5
0
 def test_Regex(self, detail):
     p = Regex("green")
     with pytest.raises(ValueError) as e:
         p.validate("junk", detail)
     assert str(e).endswith("ValueError") == (not detail)
Esempio n. 6
0
 def test_Regex(self):
     p = Regex("green")
     with pytest.raises(ValueError) as e:
         p.validate("junk")
     assert not str(e).endswith("ValueError")