Пример #1
0
 def test_Date(self) -> None:
     p = Date()
     with pytest.raises(ValueError) as e:
         p.validate(object())
     assert matches(
         str(e.value),
         r"Expected an ISO date string, got <object object at 0x.*>")
Пример #2
0
 def test_Date(self):
     p = Date()
     with pytest.raises(ValueError) as e:
         p.validate(object())
     assert matches(
         str(e.value),
         r"expected a date, string or timestamp, got <object object at 0x.*>"
     )
Пример #3
0
 def test_Date(self, detail):
     p = Date()
     with pytest.raises(ValueError) as e:
         p.validate(p, detail)
     assert str(e).endswith("ValueError") == (not detail)
Пример #4
0
 def test_Date(self):
     p = Date()
     with pytest.raises(ValueError) as e:
         p.validate(p)
     assert not str(e).endswith("ValueError")
Пример #5
0
 def test_Date(self, detail) -> None:
     p = Date()
     with pytest.raises(ValueError) as e:
         p.validate(p, detail)
     assert (str(e.value) == "") == (not detail)
Пример #6
0
 def test_Date(self, detail):
     p = Date()
     with pytest.raises(ValueError) as e:
         p.validate(p, detail)
     assert str(e).endswith("ValueError") == (not detail)
Пример #7
0
 def test_Date(self):
     p = Date()
     with pytest.raises(ValueError) as e:
         p.validate(p)
     assert not str(e).endswith("ValueError")