Repository navigation
Reject a zero step slice in PaginatedList - #3597
Conversation
PaginatedList
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3597 +/- ##
==========================================
+ Coverage 97.00% 97.10% +0.10%
==========================================
Files 172 182 +10
Lines 18934 20627 +1693
==========================================
+ Hits 18366 20029 +1663
- Misses 568 598 +30 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| self.assertEqual(self.list[0].id, 4772349) | ||
| self.assertEqual(self.list[24].id, 4286936) | ||
|
|
||
| def testSliceWithZeroStep(self): |
There was a problem hiding this comment.
Please move testSliceWithZeroStep down next to the other slice tests (testSliceIndexingInFirstPage / testSliceIndexingUntilEnd, around line 208).
There was a problem hiding this comment.
Moved testSliceWithZeroStep right after testSliceIndexingUntilEnd in 08b361c.
|
Looks fine to me, only Enrico's ask to move the test next to the other slice tests is still open. Side note, |
|
Moved |
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [PyGithub](https://redirect.github.com/pygithub/pygithub) | `==2.10.0` → `==2.11.0` |  |  | --- ### Release Notes <details> <summary>pygithub/pygithub (PyGithub)</summary> ### [`v2.11.0`](https://redirect.github.com/PyGithub/PyGithub/releases/tag/v2.11.0) [Compare Source](https://redirect.github.com/pygithub/pygithub/compare/v2.10.0...v2.11.0) #### What's Changed ##### New Features - Add deployment branch policies to `Environment` by [@​cvas22](https://redirect.github.com/cvas22) in [PyGithub/PyGithub#3612](https://redirect.github.com/PyGithub/PyGithub/pull/3612) - Add support for branch rulesets by [@​EnricoMi](https://redirect.github.com/EnricoMi) in [PyGithub/PyGithub#3617](https://redirect.github.com/PyGithub/PyGithub/pull/3617) - Allow iterating `PaginatedList` by pages by [@​EnricoMi](https://redirect.github.com/EnricoMi) in [PyGithub/PyGithub#3603](https://redirect.github.com/PyGithub/PyGithub/pull/3603) - Add `Organization.get_failed_invitations` by [@​cvas22](https://redirect.github.com/cvas22) in [PyGithub/PyGithub#3608](https://redirect.github.com/PyGithub/PyGithub/pull/3608) - Add `Issue.transfer` to move an issue to another repository by [@​cvas22](https://redirect.github.com/cvas22) in [PyGithub/PyGithub#3631](https://redirect.github.com/PyGithub/PyGithub/pull/3631) - Add `Repository.get_actions_permissions` and `ActionsRepositoryPermissions.edit` by [@​andrewfish0](https://redirect.github.com/andrewfish0) in [PyGithub/PyGithub#3583](https://redirect.github.com/PyGithub/PyGithub/pull/3583) ##### Improvements - Apply schema to `SecretScanAlert` by [@​EnricoMi](https://redirect.github.com/EnricoMi) in [PyGithub/PyGithub#3573](https://redirect.github.com/PyGithub/PyGithub/pull/3573) - Respect application logging configuration by default by [@​vzer200](https://redirect.github.com/vzer200) in [PyGithub/PyGithub#3572](https://redirect.github.com/PyGithub/PyGithub/pull/3572) - Update classes using OpenAPI spec by [@​EnricoMi](https://redirect.github.com/EnricoMi) in [PyGithub/PyGithub#3606](https://redirect.github.com/PyGithub/PyGithub/pull/3606) - Rework rate limit support by [@​EnricoMi](https://redirect.github.com/EnricoMi) in [PyGithub/PyGithub#3602](https://redirect.github.com/PyGithub/PyGithub/pull/3602) - Add rate limit information to `PaginatedList` pages by [@​EnricoMi](https://redirect.github.com/EnricoMi) in [PyGithub/PyGithub#3605](https://redirect.github.com/PyGithub/PyGithub/pull/3605) - Derive `Commit.repository` from the commit url by [@​b84330808](https://redirect.github.com/b84330808) in [PyGithub/PyGithub#3599](https://redirect.github.com/PyGithub/PyGithub/pull/3599) - Updating pyproject.toml by [@​EnricoMi](https://redirect.github.com/EnricoMi) in [PyGithub/PyGithub#3623](https://redirect.github.com/PyGithub/PyGithub/pull/3623) - Fix `creator` type hint in `Repository.get_issues` ([#​3084](https://redirect.github.com/pygithub/pygithub/issues/3084)) by [@​zxc1031408077](https://redirect.github.com/zxc1031408077) in [PyGithub/PyGithub#3598](https://redirect.github.com/PyGithub/PyGithub/pull/3598) - Fetch `Github.oauth_scopes` on access when the scopes are not known yet by [@​StrikeRougeAgent](https://redirect.github.com/StrikeRougeAgent) in [PyGithub/PyGithub#3633](https://redirect.github.com/PyGithub/PyGithub/pull/3633) - Reject a zero step slice in `PaginatedList` by [@​yuefdev](https://redirect.github.com/yuefdev) in [PyGithub/PyGithub#3597](https://redirect.github.com/PyGithub/PyGithub/pull/3597) ##### Bug Fixes - Remove commit ref support from `Workflow.create_dispatch` by [@​laysauchoa](https://redirect.github.com/laysauchoa) in [PyGithub/PyGithub#2931](https://redirect.github.com/PyGithub/PyGithub/pull/2931) - Fix listing installation repositories with user authentication by [@​hansu650](https://redirect.github.com/hansu650) in [PyGithub/PyGithub#3571](https://redirect.github.com/PyGithub/PyGithub/pull/3571) - Fix `openapi.py` and `sort_class.py` for `_useAttributes` with custom if statements by [@​EnricoMi](https://redirect.github.com/EnricoMi) in [PyGithub/PyGithub#3619](https://redirect.github.com/PyGithub/PyGithub/pull/3619) - Keep query string when following 301 redirects by [@​Enesuygurs](https://redirect.github.com/Enesuygurs) in [PyGithub/PyGithub#3600](https://redirect.github.com/PyGithub/PyGithub/pull/3600) - Allow Enterprise release asset download redirects to `/storage/releases/` by [@​wozhenbang2004](https://redirect.github.com/wozhenbang2004) in [PyGithub/PyGithub#3629](https://redirect.github.com/PyGithub/PyGithub/pull/3629) - Allow updating hooks without resending configuration by [@​wozhenbang2004](https://redirect.github.com/wozhenbang2004) in [PyGithub/PyGithub#3630](https://redirect.github.com/PyGithub/PyGithub/pull/3630) - Fix `PaginatedList.total_count` for custom `toal_count_item` by [@​EnricoMi](https://redirect.github.com/EnricoMi) in [PyGithub/PyGithub#3648](https://redirect.github.com/PyGithub/PyGithub/pull/3648) ##### Maintenance - Generate a GraphQL API reference from method annotations by [@​lzyrtxtp](https://redirect.github.com/lzyrtxtp) in [PyGithub/PyGithub#3585](https://redirect.github.com/PyGithub/PyGithub/pull/3585) - Replace `black`, `pyupgrade`, and `docformatter` with `ruff` by [@​EnricoMi](https://redirect.github.com/EnricoMi) in [PyGithub/PyGithub#3592](https://redirect.github.com/PyGithub/PyGithub/pull/3592) - Add ruff reformat commit to .git-blame-ignore-revs by [@​EnricoMi](https://redirect.github.com/EnricoMi) in [PyGithub/PyGithub#3593](https://redirect.github.com/PyGithub/PyGithub/pull/3593) - Fix logging tests by [@​EnricoMi](https://redirect.github.com/EnricoMi) in [PyGithub/PyGithub#3594](https://redirect.github.com/PyGithub/PyGithub/pull/3594) - Replace responses with vcrpy by [@​EnricoMi](https://redirect.github.com/EnricoMi) in [PyGithub/PyGithub#3563](https://redirect.github.com/PyGithub/PyGithub/pull/3563) - Restrict workflow permissions by [@​EnricoMi](https://redirect.github.com/EnricoMi) in [PyGithub/PyGithub#3611](https://redirect.github.com/PyGithub/PyGithub/pull/3611) - Fix syntax error in code scanning alert example by [@​puhupwasbind301](https://redirect.github.com/puhupwasbind301) in [PyGithub/PyGithub#3607](https://redirect.github.com/PyGithub/PyGithub/pull/3607) - Clarify that Repository.get_commit accepts any ref by [@​cvas22](https://redirect.github.com/cvas22) in [PyGithub/PyGithub#3609](https://redirect.github.com/PyGithub/PyGithub/pull/3609) - Document refreshing cached objects with update by [@​yuefdev](https://redirect.github.com/yuefdev) in [PyGithub/PyGithub#3596](https://redirect.github.com/PyGithub/PyGithub/pull/3596) - Pin tox below 4.67.14 in CI by [@​EnricoMi](https://redirect.github.com/EnricoMi) in [PyGithub/PyGithub#3620](https://redirect.github.com/PyGithub/PyGithub/pull/3620) - Test built whl package in CI by [@​EnricoMi](https://redirect.github.com/EnricoMi) in [PyGithub/PyGithub#3624](https://redirect.github.com/PyGithub/PyGithub/pull/3624) - Document GitHub App client IDs for AppAuth by [@​akoroderdeniteenfeld-sudo](https://redirect.github.com/akoroderdeniteenfeld-sudo) in [PyGithub/PyGithub#3637](https://redirect.github.com/PyGithub/PyGithub/pull/3637) - Show how to read an annotated tag message by [@​akoroderdeniteenfeld-sudo](https://redirect.github.com/akoroderdeniteenfeld-sudo) in [PyGithub/PyGithub#3643](https://redirect.github.com/PyGithub/PyGithub/pull/3643) - Clarify which object cancels an organization invitation by [@​akoroderdeniteenfeld-sudo](https://redirect.github.com/akoroderdeniteenfeld-sudo) in [PyGithub/PyGithub#3645](https://redirect.github.com/PyGithub/PyGithub/pull/3645) - Obfuscate OpenAPI test diff line context by [@​EnricoMi](https://redirect.github.com/EnricoMi) in [PyGithub/PyGithub#3647](https://redirect.github.com/PyGithub/PyGithub/pull/3647) - Add OpenAPI script tests around anyof by [@​EnricoMi](https://redirect.github.com/EnricoMi) in [PyGithub/PyGithub#3613](https://redirect.github.com/PyGithub/PyGithub/pull/3613) - Fixing rst and md formatting issues by [@​EnricoMi](https://redirect.github.com/EnricoMi) in [PyGithub/PyGithub#3622](https://redirect.github.com/PyGithub/PyGithub/pull/3622) - Fix VCR replay matching by [@​EnricoMi](https://redirect.github.com/EnricoMi) in [PyGithub/PyGithub#3646](https://redirect.github.com/PyGithub/PyGithub/pull/3646) - Add `noRecord()` to reuse replay data when recording by [@​cvas22](https://redirect.github.com/cvas22) in [PyGithub/PyGithub#3618](https://redirect.github.com/PyGithub/PyGithub/pull/3618) **Full Changelog**: <PyGithub/PyGithub@v2.10.0...v2.11.0> </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/lettuce-financial/github-bot-signed-commit). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NS4xMi4wIiwidXBkYXRlZEluVmVyIjoiNDUuMTIuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
Hi!
issues[::0]is currently treated asissues[::1], silently iterating normally and potentially fetching pages. Python sequences reject a zero slice step withValueError.Reject it when constructing the slice, before iteration or any API request. Added a regression that failed before the fix.
All 40 pagination tests pass on Windows/Python 3.14; both changed files pass Ruff lint and formatting.