test_exceptions.py 786 B

12345678910111213141516171819202122232425262728293031
  1. import unittest
  2. from yarg import HTTPError
  3. class TestHTTPErrorWithReason(unittest.TestCase):
  4. def setUp(self):
  5. self.error = HTTPError(status_code=300,
  6. reason="Test")
  7. def test_repr(self):
  8. self.assertEqual('<HTTPError 300 Test>',
  9. self.error.__repr__())
  10. def test_str(self):
  11. self.assertEqual('<HTTPError 300 Test>',
  12. self.error.__str__())
  13. class TestHTTPErrorNoReason(unittest.TestCase):
  14. def setUp(self):
  15. self.error = HTTPError()
  16. def test_repr(self):
  17. self.assertEqual('<HTTPError>',
  18. self.error.__repr__())
  19. def test_str(self):
  20. self.assertEqual('<HTTPError>',
  21. self.error.__str__())