You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is sort of the inverse of #627. I wasn't sure if I should combine the two issues or not.
Using Version 1.0.0a4, Repository.directory_contents throws an AttributeError when you mistakenly give it a path to a file rather than a directory. It looks like the code isn't expecting that to happen.
Given that contents() was split into directory_contents() and file_contents(), it would be nice if both could handle when they're used incorrectly and throw an appropriate error.
example:
>>> from github3 import login
>>> gh = login('<username>', password='<password>')
>>> repo = gh.repository('sigmavirus24', 'github3.py')
>>> repo.directory_contents('README.rst')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/andy.husak/.virtualenvs/repo_api/lib/python2.7/site-packages/github3/repos/repo.py", line 1130, in directory_contents
return return_as((j.get('name'), Contents(j, self)) for j in json)
File "/home/andy.husak/.virtualenvs/repo_api/lib/python2.7/site-packages/github3/repos/repo.py", line 1130, in <genexpr>
return return_as((j.get('name'), Contents(j, self)) for j in json)
AttributeError: 'unicode' object has no attribute 'get'
The text was updated successfully, but these errors were encountered:
When the wrong data type is passed to the method, like a list or string,
an exception is returned. Instead, we should be raising the exception.
I added a single unit test, which asserts that an error is raised.
Fixessigmavirus24#628 and
sigmavirus24#627.
When the wrong data type is passed to the method, like a list or string,
an exception is returned. Instead, we should be raising the exception.
I added a single unit test, which asserts that an error is raised.
Fixessigmavirus24#628 and
sigmavirus24#627.
Uh oh!
There was an error while loading. Please reload this page.
This is sort of the inverse of #627. I wasn't sure if I should combine the two issues or not.
Using Version 1.0.0a4, Repository.directory_contents throws an AttributeError when you mistakenly give it a path to a file rather than a directory. It looks like the code isn't expecting that to happen.
Given that contents() was split into directory_contents() and file_contents(), it would be nice if both could handle when they're used incorrectly and throw an appropriate error.
example:
The text was updated successfully, but these errors were encountered: