Пример #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"
Пример #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)
Пример #3
0
 def test_catch(self):
     exc = RedditAPIException([["test", "testing", "test"]])
     with pytest.raises(APIException):
         raise exc