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

New function validate-invariants #928

Merged

Conversation

sarahsonder
Copy link
Contributor

@sarahsonder sarahsonder commented Jul 12, 2023

Motivation and Context

To explicitly check that the representation invariants of an object are satisfied.

Your Changes

Description:
Created a new function called validate_invariants which takes in an object obj and checks that the representation invariants of obj are satifised.

Type of change

  • New feature (non-breaking change which adds functionality)

Testing

Created testing suite test_validate_invariants.py.

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 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.

@sarahsonder you're definitely on the right track here! In addition to writing tests (of course), my main comment is you've correctly found some existing code on which to base you work. But now that you've done so, the best approach is to refactor your code to remove the duplication, so that the common code is used in existing place and in the new function you've added. This might mean defining new helper methods as appropriate.

@sarahsonder sarahsonder marked this pull request as ready for review July 17, 2023 23:40
@coveralls
Copy link
Collaborator

coveralls commented Jul 17, 2023

Pull Request Test Coverage Report for Build 5663898953

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

Totals Coverage Status
Change from base Build 5579502227: 0.02%
Covered Lines: 3064
Relevant Lines: 3256

💛 - 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.

@sarahsonder good work. I left some inline comments, but also make sure to add this new function to the contract checking documentation page.

CHANGELOG.md Outdated Show resolved Hide resolved
python_ta/contracts/__init__.py Outdated Show resolved Hide resolved
tests/test_check_invariants.py Outdated Show resolved Hide resolved
tests/test_check_invariants.py Outdated Show resolved Hide resolved
docs/contracts/index.md Outdated Show resolved Hide resolved
python_ta/contracts/__init__.py Outdated Show resolved Hide resolved
tests/test_check_invariants.py Outdated Show resolved Hide resolved
@sarahsonder sarahsonder changed the title New function check invariants New function validate invariants Jul 26, 2023
@sarahsonder sarahsonder changed the title New function validate invariants New function validate-invariants Jul 26, 2023
@david-yz-liu david-yz-liu merged commit b89f42c into pyta-uoft:master Jul 27, 2023
5 checks passed
@sarahsonder sarahsonder deleted the new-function-check-invariants branch August 7, 2023 20:29
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.

3 participants