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

Improve rand tests #265

Merged
merged 20 commits into from
Nov 25, 2023
Merged

Improve rand tests #265

merged 20 commits into from
Nov 25, 2023

Conversation

vprusso
Copy link
Owner

@vprusso vprusso commented Nov 19, 2023

Started off doing some improvements for the testing in rand/ and hit a few additional areas. Namely:

  • Adding parameterization to a subset of tests
  • Reformatting lines based on the new longer linting standard
  • Fixing both inner_product and outer_product functions (these most likely can be removed as they are just numpy wrappers)
  • Adding more comprehensive docstrings to vectors_from_gram_matrix and gram_matrix_to_vectors functions.
  • Minor simplifications and cleanup.
  • Increasing coverage of tensor product function.

@vprusso vprusso requested a review from purva-thakre November 19, 2023 15:08
Copy link

codecov bot commented Nov 19, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (08ea5ee) 98.0% compared to head (e00c182) 98.1%.

Additional details and impacted files
@@          Coverage Diff           @@
##           master    #265   +/-   ##
======================================
  Coverage    98.0%   98.1%           
======================================
  Files         291     291           
  Lines        6914    6908    -6     
  Branches      786     774   -12     
======================================
- Hits         6781    6777    -4     
  Misses         90      90           
+ Partials       43      41    -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@vprusso
Copy link
Owner Author

vprusso commented Nov 19, 2023

Sorry for all the noise on this one. I'll be leaving this one alone for now so it stays stable. Should be good to be reviewed, @purva-thakre !

@vprusso vprusso mentioned this pull request Nov 24, 2023
3 tasks
@vprusso
Copy link
Owner Author

vprusso commented Nov 24, 2023

Just a ping for this PR and #271 to see if we want to get these in before some of the other PRs coming down the pipe (might make the merging easier if we chuck these in first) fyi @purva-thakre

Copy link
Collaborator

@purva-thakre purva-thakre left a comment

Choose a reason for hiding this comment

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

LGTM except for a few minor changes.

I think we do want to use pytest.raises to test if an error is raised correctly. One thing I noticed after working on some of the issues in #217 is, if numpy is used to check things like this, the covered line might show up as uncovered to pytest.

toqito/matrix_ops/tests/test_inner_product.py Outdated Show resolved Hide resolved
toqito/matrix_ops/tests/test_inner_product.py Outdated Show resolved Hide resolved
toqito/matrix_ops/tests/test_outer_product.py Outdated Show resolved Hide resolved
toqito/matrix_ops/tests/test_outer_product.py Outdated Show resolved Hide resolved
toqito/matrix_ops/tests/test_tensor.py Outdated Show resolved Hide resolved
toqito/rand/tests/test_random_density_matrix.py Outdated Show resolved Hide resolved
toqito/rand/tests/test_random_unitary.py Outdated Show resolved Hide resolved
toqito/rand/tests/test_random_unitary.py Outdated Show resolved Hide resolved
toqito/rand/tests/test_random_state_vector.py Outdated Show resolved Hide resolved
toqito/states/tests/test_werner.py Outdated Show resolved Hide resolved
@vprusso
Copy link
Owner Author

vprusso commented Nov 25, 2023

Thanks again for the review, @purva-thakre !

@vprusso vprusso merged commit 77e9363 into master Nov 25, 2023
@vprusso vprusso deleted the improve-rand-tests branch November 25, 2023 03:10
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.

2 participants