diff --git a/.coveragerc b/.coveragerc index c8dc94f..664467b 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,2 +1,8 @@ [run] omit = twython/advisory.py + +[report] +exclude_lines = + pragma: no cover + + def __repr__ diff --git a/tests/test_core.py b/tests/test_core.py index b34cf39..d4ddfb3 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -104,6 +104,11 @@ class TwythonAPITestCase(unittest.TestCase): self.assertRaises(TwythonAuthError, self.api.get_user_timeline, screen_name=protected_twitter_2) + def test_retweeted_of_me(self): + """Test that getting recent tweets by authenticated user that have + been retweeted by others succeeds""" + self.api.retweeted_of_me() + def test_get_home_timeline(self): """Test returning home timeline for authenticated user succeeds""" self.api.get_home_timeline() diff --git a/tests/test_streaming.py b/tests/test_streaming.py index c6b83bc..a75d98c 100644 --- a/tests/test_streaming.py +++ b/tests/test_streaming.py @@ -16,18 +16,6 @@ class TwythonStreamTestCase(unittest.TestCase): def on_error(self, status_code, data): raise TwythonStreamError(data) - def on_delete(self, data): - return - - def on_limit(self, data): - return - - def on_disconnect(self, data): - return - - def on_timeout(self, data): - return - self.api = MyStreamer(app_key, app_secret, oauth_token, oauth_token_secret) diff --git a/twython/endpoints.py b/twython/endpoints.py index 5f27dde..4c34188 100644 --- a/twython/endpoints.py +++ b/twython/endpoints.py @@ -93,7 +93,7 @@ class EndpointsMixin(object): """ return self.post('statuses/retweet/%s' % params.get('id')) - def update_status_with_media(self, **params): + def update_status_with_media(self, **params): # pragma: no cover """Updates the authenticating user's current status and attaches media for upload. In other words, it creates a Tweet with a picture attached. @@ -323,7 +323,7 @@ class EndpointsMixin(object): """ return self.post('account/update_profile', params=params) - def update_profile_background_image(self, **params): + def update_profile_banner_image(self, **params): # pragma: no cover """Updates the authenticating user's profile background image. Docs: https://dev.twitter.com/docs/api/1.1/post/account/update_profile_background_image @@ -340,7 +340,7 @@ class EndpointsMixin(object): """ return self.post('account/update_profile_colors', params=params) - def update_profile_image(self, **params): + def update_profile_image(self, **params): # pragma: no cover """Updates the authenticating user's profile image. Docs: https://dev.twitter.com/docs/api/1.1/post/account/update_profile_image @@ -431,13 +431,13 @@ class EndpointsMixin(object): """ return self.post('account/remove_profile_banner', params=params) - def update_profile_Background_image(self, **params): + def update_profile_background_image(self, **params): """Uploads a profile banner on behalf of the authenticating user. Docs: https://dev.twitter.com/docs/api/1.1/post/account/update_profile_banner """ - return self.post('ccount/update_profile_background_image', params=params) + return self.post('account/update_profile_background_image', params=params) def get_profile_banner_sizes(self, **params): """Returns a map of the available size variations of the specified user's profile banner. @@ -712,7 +712,7 @@ class EndpointsMixin(object): """ return self.get('geo/similar_places', params=params) - def create_place(self, **params): + def create_place(self, **params): # pragma: no cover """Creates a new place object at the given latitude and longitude. Docs: https://dev.twitter.com/docs/api/1.1/post/geo/place diff --git a/twython/exceptions.py b/twython/exceptions.py index cb8c077..b9c9df5 100644 --- a/twython/exceptions.py +++ b/twython/exceptions.py @@ -29,7 +29,7 @@ class TwythonError(Exception): super(TwythonError, self).__init__(msg) @property - def msg(self): + def msg(self): # pragma: no cover return self.args[0] @@ -41,7 +41,7 @@ class TwythonAuthError(TwythonError): pass -class TwythonRateLimitError(TwythonError): +class TwythonRateLimitError(TwythonError): # pragma: no cover """Raised when you've hit a rate limit. The amount of seconds to retry your request in will be appended diff --git a/twython/helpers.py b/twython/helpers.py index 1d3b004..24ad835 100644 --- a/twython/helpers.py +++ b/twython/helpers.py @@ -16,7 +16,7 @@ def _transparent_params(_params): files = {} for k, v in _params.items(): if hasattr(v, 'read') and callable(v.read): - files[k] = v + files[k] = v # pragma: no cover elif isinstance(v, bool): if v: params[k] = 'true' @@ -27,5 +27,5 @@ def _transparent_params(_params): elif isinstance(v, list): params[k] = ','.join(v) else: - continue + continue # pragma: no cover return params, files diff --git a/twython/streaming/api.py b/twython/streaming/api.py index 2496763..21b3a7f 100644 --- a/twython/streaming/api.py +++ b/twython/streaming/api.py @@ -113,7 +113,7 @@ class TwythonStreamer(object): response.close() - def on_success(self, data): + def on_success(self, data): # pragma: no cover """Called when data has been successfull received from the stream Feel free to override this to handle your streaming data how you @@ -132,7 +132,7 @@ class TwythonStreamer(object): elif 'disconnect' in data: self.on_disconnect(data.get('disconnect')) - def on_error(self, status_code, data): + def on_error(self, status_code, data): # pragma: no cover """Called when stream returns non-200 status code Feel free to override this to handle your streaming data how you @@ -146,7 +146,7 @@ class TwythonStreamer(object): """ return - def on_delete(self, data): + def on_delete(self, data): # pragma: no cover """Called when a deletion notice is received Feel free to override this to handle your streaming data how you @@ -159,7 +159,7 @@ class TwythonStreamer(object): """ return - def on_limit(self, data): + def on_limit(self, data): # pragma: no cover """Called when a limit notice is received Feel free to override this to handle your streaming data how you @@ -172,7 +172,7 @@ class TwythonStreamer(object): """ return - def on_disconnect(self, data): + def on_disconnect(self, data): # pragma: no cover """Called when a disconnect notice is received Feel free to override this to handle your streaming data how you @@ -185,7 +185,7 @@ class TwythonStreamer(object): """ return - def on_timeout(self): + def on_timeout(self): # pragma: no cover """ Called when the request has timed out """ return