From 8d22935180191aa41a433f2cf0a4d9aa6ca6b074 Mon Sep 17 00:00:00 2001 From: davidbrai Date: Wed, 19 Jun 2013 00:36:03 +0300 Subject: [PATCH] bugfix: using custom per_page in repo.get_comments --- github/PaginatedList.py | 2 +- github/tests/PaginatedList.py | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/github/PaginatedList.py b/github/PaginatedList.py index b71d55dc..7e1ee234 100644 --- a/github/PaginatedList.py +++ b/github/PaginatedList.py @@ -97,7 +97,7 @@ class PaginatedList(PaginatedListBase): self.__firstUrl = firstUrl self.__firstParams = firstParams or () self.__nextUrl = firstUrl - self.__nextParams = firstParams + self.__nextParams = firstParams or {} if self.__requester.per_page != 30: self.__nextParams["per_page"] = self.__requester.per_page diff --git a/github/tests/PaginatedList.py b/github/tests/PaginatedList.py index 731eb6bf..1658d3ee 100644 --- a/github/tests/PaginatedList.py +++ b/github/tests/PaginatedList.py @@ -15,7 +15,8 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . import Framework - +import CommitComment +from github.PaginatedList import PaginatedList as PaginatedListImpl class PaginatedList(Framework.TestCase): def setUp(self): @@ -88,6 +89,15 @@ class PaginatedList(Framework.TestCase): self.g.per_page = 100 self.assertEqual(self.g.per_page, 100) self.assertEqual(len(list(self.repo.get_issues())), 456) + + def testCustomPerPageWithNoUrlParams(self): + self.g.per_page = 100 + paginated_list = PaginatedListImpl( + CommitComment.CommitComment, + self.repo._requester, + self.repo.url + "/comments", + None + ) def testCustomPerPageWithGetPage(self): self.g.per_page = 100