예제 #1
0
 def __init__(self, permissions: list):
     assert_journy(isinstance(permissions, list),
                   "Permissions is not a list.")
     for permission in permissions:
         assert_journy(isinstance(permission, str),
                       "Permissions is not a list of strings.")
     self.permissions = permissions
예제 #2
0
    def __init__(self, request_id: str, calls_remaining: int, data: T):
        assert_journy(isinstance(request_id, str),
                      "request_id is not a string.")
        assert_journy(isinstance(calls_remaining, int),
                      "calls_remaining is not an int")

        self.request_id = request_id
        self.calls_remaining = calls_remaining
        self.data = data
예제 #3
0
    def __init__(self, request_id: str or None, calls_remaining: int or None,
                 error: APIError):
        if request_id:
            assert_journy(isinstance(request_id, str),
                          "request_id is not a string.")
        if calls_remaining:
            assert_journy(isinstance(calls_remaining, int),
                          "calls_remaining is not an int.")
        assert_journy(isinstance(error, APIError),
                      "error is no APIError object.")

        self.request_id = request_id
        self.calls_remaining = calls_remaining
        self.error = error
예제 #4
0
    def __init__(self, domain: str, snippet: str):
        assert_journy(isinstance(domain, str), "The domain is not a string.")
        assert_journy(isinstance(snippet, str), "The request is not a string.")

        self.domain = domain
        self.snippet = snippet
예제 #5
0
def test_assert_journy():
    with pytest.raises(JournyException) as exception:
        assert_journy(isinstance(1, str), "Not a string")
    assert exception.value.msg == "Not a string"