Add coverage ignore pragmas

This commit is contained in:
Pete 2013-08-26 12:57:47 -07:00
parent 7e4fb52d93
commit f742df27b4
4 changed files with 8 additions and 8 deletions

View file

@ -9,7 +9,7 @@ except ImportError:
from ConfigParser import SafeConfigParser as ConfigParser # Python2 from ConfigParser import SafeConfigParser as ConfigParser # Python2
try: try:
import io # Python3 import io # Python3
except ImportError: except ImportError: # pragma: no cover
import StringIO as io # Python2 import StringIO as io # Python2
class Auth(object): class Auth(object):

View file

@ -17,7 +17,7 @@ from .auth import Auth
if sys.version < '3': if sys.version < '3':
TEXT_TYPE = unicode TEXT_TYPE = unicode
else: else: # pragma: no cover
TEXT_TYPE = str TEXT_TYPE = str
DUPLICATE_RESPONSE = {"code": 409, DUPLICATE_RESPONSE = {"code": 409,
@ -43,7 +43,7 @@ class Http(object):
self.config = dict(self._CONFIG_DEFAULTS) 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 " print("Deprecation Warning: api_version should be set by "
"calling the configure function") "calling the configure function")
self.config["api_version"] = api_version self.config["api_version"] = api_version
@ -246,7 +246,7 @@ def result_to_list(result):
""" Handle the case where the result contains no items """ """ Handle the case where the result contains no items """
if not result: if not result:
return [] return []
if result[0]["totalRows"] == 0: if "totalRows" in result[0] and result[0]["totalRows"] == 0:
return [] return []
else: else:
return result return result

View file

@ -129,5 +129,5 @@ def extract_files(params):
return updated_params, files return updated_params, files
if __name__ == "__main__": if __name__ == "__main__": # pragma: no cover
main() main()

View file

@ -62,7 +62,7 @@ class Photo(TroveboxObject):
value = {} value = {}
if "next" in result: if "next" in result:
# Workaround for APIv1 # Workaround for APIv1
if not isinstance(result["next"], list): if not isinstance(result["next"], list): # pragma: no cover
result["next"] = [result["next"]] result["next"] = [result["next"]]
value["next"] = [] value["next"] = []
@ -71,7 +71,7 @@ class Photo(TroveboxObject):
if "previous" in result: if "previous" in result:
# Workaround for APIv1 # Workaround for APIv1
if not isinstance(result["previous"], list): if not isinstance(result["previous"], list): # pragma: no cover
result["previous"] = [result["previous"]] result["previous"] = [result["previous"]]
value["previous"] = [] value["previous"] = []
@ -89,7 +89,7 @@ class Photo(TroveboxObject):
self.id, **kwds)["result"] self.id, **kwds)["result"]
# APIv1 doesn't return the transformed photo (frontend issue #955) # 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" % result = self._trovebox.get("/photo/%s/view.json" %
self.id)["result"] self.id)["result"]