Skip to content

Commit 5692c1e

Browse files
committed
Acknowledge lack of test coverage in the old Download API
1 parent 22f366b commit 5692c1e

2 files changed

Lines changed: 15 additions & 13 deletions

File tree

github/Download.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,11 @@ def _initAttributes(self):
226226

227227
def _useAttributes(self, attributes):
228228
if "accesskeyid" in attributes: # pragma no branch
229-
self._accesskeyid = self._makeStringAttribute(attributes["accesskeyid"])
229+
self._accesskeyid = self._makeStringAttribute(attributes["accesskeyid"]) # pragma no cover (was covered only by create_download, which has been removed)
230230
if "acl" in attributes: # pragma no branch
231-
self._acl = self._makeStringAttribute(attributes["acl"])
231+
self._acl = self._makeStringAttribute(attributes["acl"]) # pragma no cover (was covered only by create_download, which has been removed)
232232
if "bucket" in attributes: # pragma no branch
233-
self._bucket = self._makeStringAttribute(attributes["bucket"])
233+
self._bucket = self._makeStringAttribute(attributes["bucket"]) # pragma no cover (was covered only by create_download, which has been removed)
234234
if "content_type" in attributes: # pragma no branch
235235
self._content_type = self._makeStringAttribute(attributes["content_type"])
236236
if "created_at" in attributes: # pragma no branch
@@ -240,27 +240,27 @@ def _useAttributes(self, attributes):
240240
if "download_count" in attributes: # pragma no branch
241241
self._download_count = self._makeIntAttribute(attributes["download_count"])
242242
if "expirationdate" in attributes: # pragma no branch
243-
self._expirationdate = self._makeDatetimeAttribute(attributes["expirationdate"])
243+
self._expirationdate = self._makeDatetimeAttribute(attributes["expirationdate"]) # pragma no cover (was covered only by create_download, which has been removed)
244244
if "html_url" in attributes: # pragma no branch
245245
self._html_url = self._makeStringAttribute(attributes["html_url"])
246246
if "id" in attributes: # pragma no branch
247247
self._id = self._makeIntAttribute(attributes["id"])
248248
if "mime_type" in attributes: # pragma no branch
249-
self._mime_type = self._makeStringAttribute(attributes["mime_type"])
249+
self._mime_type = self._makeStringAttribute(attributes["mime_type"]) # pragma no cover (was covered only by create_download, which has been removed)
250250
if "name" in attributes: # pragma no branch
251251
self._name = self._makeStringAttribute(attributes["name"])
252252
if "path" in attributes: # pragma no branch
253-
self._path = self._makeStringAttribute(attributes["path"])
253+
self._path = self._makeStringAttribute(attributes["path"]) # pragma no cover (was covered only by create_download, which has been removed)
254254
if "policy" in attributes: # pragma no branch
255-
self._policy = self._makeStringAttribute(attributes["policy"])
255+
self._policy = self._makeStringAttribute(attributes["policy"]) # pragma no cover (was covered only by create_download, which has been removed)
256256
if "prefix" in attributes: # pragma no branch
257-
self._prefix = self._makeStringAttribute(attributes["prefix"])
257+
self._prefix = self._makeStringAttribute(attributes["prefix"]) # pragma no cover (was covered only by create_download, which has been removed)
258258
if "redirect" in attributes: # pragma no branch
259-
self._redirect = self._makeBoolAttribute(attributes["redirect"])
259+
self._redirect = self._makeBoolAttribute(attributes["redirect"]) # pragma no cover (was covered only by create_download, which has been removed)
260260
if "s3_url" in attributes: # pragma no branch
261-
self._s3_url = self._makeStringAttribute(attributes["s3_url"])
261+
self._s3_url = self._makeStringAttribute(attributes["s3_url"]) # pragma no cover (was covered only by create_download, which has been removed)
262262
if "signature" in attributes: # pragma no branch
263-
self._signature = self._makeStringAttribute(attributes["signature"])
263+
self._signature = self._makeStringAttribute(attributes["signature"]) # pragma no cover (was covered only by create_download, which has been removed)
264264
if "size" in attributes: # pragma no branch
265265
self._size = self._makeIntAttribute(attributes["size"])
266266
if "url" in attributes: # pragma no branch

github/GithubObject.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,10 @@ def _makeTimestampAttribute(value):
154154
@staticmethod
155155
def _makeDatetimeAttribute(value):
156156
def parseDatetime(s):
157-
if len(s) == 24:
158-
return datetime.datetime.strptime(s, "%Y-%m-%dT%H:%M:%S.000Z")
157+
if len(s) == 24: # pragma no branch (This branch was used only when creating a download)
158+
# The Downloads API has been removed. I'm keeping this branch because I have no mean
159+
# to check if it's really useless now.
160+
return datetime.datetime.strptime(s, "%Y-%m-%dT%H:%M:%S.000Z") # pragma no cover (This branch was used only when creating a download)
159161
elif len(s) == 25:
160162
return datetime.datetime.strptime(s[:19], "%Y-%m-%dT%H:%M:%S") + (1 if s[19] == '-' else -1) * datetime.timedelta(hours=int(s[20:22]), minutes=int(s[23:25]))
161163
else:

0 commit comments

Comments
 (0)