From f742df27b472e958facf93c9d1b8cdb30132836c Mon Sep 17 00:00:00 2001 From: Pete Date: Mon, 26 Aug 2013 12:57:47 -0700 Subject: [PATCH] Add coverage ignore pragmas --- trovebox/auth.py | 2 +- trovebox/http.py | 6 +++--- trovebox/main.py | 2 +- trovebox/objects/photo.py | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/trovebox/auth.py b/trovebox/auth.py index 378ee65..b3e29ed 100644 --- a/trovebox/auth.py +++ b/trovebox/auth.py @@ -9,7 +9,7 @@ except ImportError: from ConfigParser import SafeConfigParser as ConfigParser # Python2 try: import io # Python3 -except ImportError: +except ImportError: # pragma: no cover import StringIO as io # Python2 class Auth(object): diff --git a/trovebox/http.py b/trovebox/http.py index ffe3b5f..dd33917 100644 --- a/trovebox/http.py +++ b/trovebox/http.py @@ -17,7 +17,7 @@ from .auth import Auth if sys.version < '3': TEXT_TYPE = unicode -else: +else: # pragma: no cover TEXT_TYPE = str DUPLICATE_RESPONSE = {"code": 409, @@ -43,7 +43,7 @@ class Http(object): self.config = dict(self._CONFIG_DEFAULTS) - if api_version is not None: + if api_version is not None: # pragma: no cover print("Deprecation Warning: api_version should be set by " "calling the configure function") self.config["api_version"] = api_version @@ -246,7 +246,7 @@ def result_to_list(result): """ Handle the case where the result contains no items """ if not result: return [] - if result[0]["totalRows"] == 0: + if "totalRows" in result[0] and result[0]["totalRows"] == 0: return [] else: return result diff --git a/trovebox/main.py b/trovebox/main.py index b7b84e4..b9b9f4f 100644 --- a/trovebox/main.py +++ b/trovebox/main.py @@ -129,5 +129,5 @@ def extract_files(params): return updated_params, files -if __name__ == "__main__": +if __name__ == "__main__": # pragma: no cover main() diff --git a/trovebox/objects/photo.py b/trovebox/objects/photo.py index a5b3f4e..ffb66af 100644 --- a/trovebox/objects/photo.py +++ b/trovebox/objects/photo.py @@ -62,7 +62,7 @@ class Photo(TroveboxObject): value = {} if "next" in result: # Workaround for APIv1 - if not isinstance(result["next"], list): + if not isinstance(result["next"], list): # pragma: no cover result["next"] = [result["next"]] value["next"] = [] @@ -71,7 +71,7 @@ class Photo(TroveboxObject): if "previous" in result: # Workaround for APIv1 - if not isinstance(result["previous"], list): + if not isinstance(result["previous"], list): # pragma: no cover result["previous"] = [result["previous"]] value["previous"] = [] @@ -89,7 +89,7 @@ class Photo(TroveboxObject): self.id, **kwds)["result"] # APIv1 doesn't return the transformed photo (frontend issue #955) - if isinstance(result, bool): + if isinstance(result, bool): # pragma: no cover result = self._trovebox.get("/photo/%s/view.json" % self.id)["result"]