Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring the assert statement. #3810

Merged
merged 1 commit into from
Jul 27, 2023
Merged

Refactoring the assert statement. #3810

merged 1 commit into from
Jul 27, 2023

Conversation

freddiewanah
Copy link
Contributor

Description

Hello, first-time submitting PR here.

This PR updates an assert statement that checks the bounds of a string-slicing operation. The updated assertion provides more accurate and informative error handling by specifically checking the relative values of the indices and the string length.

The original assertion was essentially checking if Python's string slicing was behaving as expected. However, it wasn't providing any guarantees or useful information about the bounds i and j themselves.

The updated assertion checks that the indices used for slicing are within the bounds of the string. It will throw an AssertionError if the indices are out of bounds or if i > j, providing a more specific and informative error.

Checklist - did you ...

  • Add an entry in CHANGES.md if necessary?
  • Add / update tests if necessary?
  • Add new / update outdated documentation?

Happy to update more related issues in the test code if needed :)

@JelleZijlstra JelleZijlstra added the skip news Pull requests that don't need a changelog entry. label Jul 24, 2023
Copy link
Collaborator

@ichard26 ichard26 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ichard26 ichard26 merged commit 133af57 into psf:main Jul 27, 2023
26 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news Pull requests that don't need a changelog entry.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants