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

Fix invalid-range-index bug #969

Merged

Conversation

ch-iv
Copy link
Contributor

@ch-iv ch-iv commented Oct 5, 2023

This PR fixes a bug where InvalidRangeIndexChecker would incorrectly identify invalid range calls. This PR also implements tests to test the fix. Fixes #967

Motivation and Context

It solves an issue some students in CSC110 were having with range calls.

image

The range produces more than 1 value, however it is flagged as invalid regardless.

Your Changes

Implement a correct way of checking range calls.

Description:

Type of change (select all that apply):

  • Bug fix (non-breaking change which fixes an issue)

Testing

Tested with hypothesis for correctness. Also unit tests provided.

Checklist

  • I have performed a self-review of my own code.
  • I have verified that the CI tests have passed.
  • I have reviewed the test coverage changes reported on Coveralls.
  • I have added tests for my changes.
  • I have updated the CHANGELOG.md file.

Copy link
Contributor

@david-yz-liu david-yz-liu left a comment

Choose a reason for hiding this comment

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

@ch-iv thanks for making this pull request! I left a few quick comments inline.

In addition to those:

  1. Please update this branch from master; you'll find when merging that I've added a "Bug Fixes" subsection underneath "Unreleased", and you can add your CHANGELOG entry underneath that.
  2. If you'd like to be recognized for your work, please add your name to the list of contributors in the README file :)

python_ta/checkers/invalid_range_index_checker.py Outdated Show resolved Hide resolved
python_ta/checkers/invalid_range_index_checker.py Outdated Show resolved Hide resolved
@ch-iv
Copy link
Contributor Author

ch-iv commented Oct 9, 2023

@david-yz-liu Thanks for the feedback. I just pushed all the suggested fixes to the branch.

@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 6451309517

  • 17 of 17 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.005%) to 94.598%

Totals Coverage Status
Change from base Build 6444397225: 0.005%
Covered Lines: 3397
Relevant Lines: 3591

💛 - Coveralls

Copy link
Contributor

@david-yz-liu david-yz-liu left a comment

Choose a reason for hiding this comment

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

@ch-iv great work, thank you!

@david-yz-liu david-yz-liu merged commit f4594cd into pyta-uoft:master Oct 9, 2023
6 checks passed
@david-yz-liu david-yz-liu mentioned this pull request Oct 9, 2023
7 tasks
@david-yz-liu david-yz-liu added this to the v2.6.3 milestone Oct 9, 2023
@ch-iv ch-iv deleted the fix_invalid_range_index_checker branch October 12, 2023 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug in invalid_range_index_checker
3 participants