Ejemplo n.º 1
0
 def test_apiexception_value(self):
     exc = RedditAPIException("test", "testing", "test")
     assert exc.error_type == "test"
     exc2 = RedditAPIException(["test", "testing", "test"])
     assert exc2.message == "testing"
     exc3 = RedditAPIException([["test", "testing", "test"]])
     assert exc3.field == "test"
Ejemplo n.º 2
0
 def test_items(self):
     container = RedditAPIException(
         [
             ["BAD_SOMETHING", "invalid something", "some_field"],
             RedditErrorItem("BAD_SOMETHING", "invalid something", "some_field"),
         ]
     )
     for exception in container.items:
         assert isinstance(exception, RedditErrorItem)
Ejemplo n.º 3
0
 def test_catch(self):
     exc = RedditAPIException([["test", "testing", "test"]])
     with pytest.raises(APIException):
         raise exc