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

Remove np.testing from unit tests #488

Open
2 of 100 tasks
purva-thakre opened this issue Feb 24, 2024 · 4 comments
Open
2 of 100 tasks

Remove np.testing from unit tests #488

purva-thakre opened this issue Feb 24, 2024 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed pytest

Comments

@purva-thakre
Copy link
Collaborator

purva-thakre commented Feb 24, 2024

Based on the discussion in #423, we want to remove all instances of np.testing and switch to using pytest. #423 (comment) has an alternative to comparing two arrays using pytest.

Wherever possible, use parametrize to better organize identical tests in 1 file. https://docs.pytest.org/en/7.3.x/how-to/parametrize.html

Below is an itemized list of the files that require these changes. If you are interested in working on one of these, comment with which item you want to work on. A maintainer will assign that item to you.

  • toqito/perms/tests/test_swap.py #492
  • toqito/states/tests/test_ghz.py
  • toqito/states/tests/test_bb84.py
  • toqito/states/tests/test_trine.py
  • toqito/states/tests/test_werner.py
  • toqito/rand/tests/test_random_povm.py
  • toqito/states/tests/test_max_mixed.py
  • toqito/matrix_props/tests/test_is_normal.py
  • toqito/matrix_props/tests/test_majorizes.py
  • toqito/measurement_props/tests/test_is_povm.py
  • toqito/state_props/tests/test_l1_norm_coherence.py
  • toqito/state_props/tests/test_purity.py
  • toqito/helper/tests/test_np_array_as_expr.py
  • toqito/state_props/tests/test_log_negativity.py
  • toqito/state_metrics/tests/test_fidelity.py
  • toqito/state_props/tests/test_is_ppt.py
  • toqito/states/tests/test_mutually_unbiased_basis.py
  • toqito/matrix_props/tests/test_is_circulant.py
  • toqito/state_props/tests/test_is_npt.py
  • toqito/matrix_props/tests/test_is_totally_positive.py
  • toqito/matrix_ops/tests/test_outer_product.py
  • toqito/rand/tests/test_random_density_matrix.py
  • toqito/states/tests/test_gen_bell.py
  • toqito/state_props/tests/test_is_unextendible_product_basis.py
  • toqito/matrix_props/tests/test_is_diagonally_dominant.py
  • toqito/matrix_props/tests/test_is_unitary.py
  • toqito/rand/tests/test_random_ginibre.py
  • toqito/matrix_props/tests/test_is_hermitian.py
  • toqito/matrix_props/tests/test_is_projection.py
  • toqito/state_opt/tests/test_symmetric_extension_hierarchy.py
  • toqito/matrix_props/tests/test_is_density.py
  • toqito/measurement_ops/tests/test_measure.py
  • toqito/helper/tests/test_expr_as_np_array.py
  • toqito/state_props/tests/test_concurrence.py
  • toqito/state_metrics/tests/test_bures_angle.py
  • toqito/matrix_props/tests/test_is_idempotent.py
  • toqito/states/tests/test_basis.py
  • toqito/state_props/tests/test_is_product.py
  • toqito/channel_props/tests/test_choi_rank.py
  • toqito/channel_props/tests/test_is_quantum_channel.py
  • toqito/state_props/tests/test_negativity.py
  • toqito/matrix_ops/tests/test_vectors_to_gram_matrix.py
  • toqito/channels/tests/test_depolarizing.py
  • toqito/matrices/tests/test_cnot.py
  • toqito/channel_props/tests/test_is_unitary.py
  • toqito/state_metrics/tests/test_sub_fidelity.py
  • toqito/helper/tests/test_channel_dim.py
  • toqito/channel_props/tests/test_is_positive.py
  • toqito/states/tests/test_tile.py
  • toqito/nonlocal_games/tests/test_nonlocal_game.py
  • toqito/states/tests/test_isotropic.py
  • toqito/states/tests/test_brauer.py
  • toqito/state_metrics/tests/test_hilbert_schmidt_inner_product.py
  • toqito/state_props/tests/test_has_symmetric_extension.py
  • toqito/matrix_props/tests/test_is_linearly_independent.py
  • toqito/matrix_props/tests/test_is_identity.py
  • toqito/channel_props/tests/test_is_herm_preserving.py
  • toqito/state_metrics/tests/test_trace_distance.py
  • toqito/states/tests/test_bell.py
  • toqito/channels/tests/test_dephasing.py
  • toqito/matrix_props/tests/test_is_diagonal.py
  • toqito/matrices/tests/test_fourier.py
  • toqito/perms/tests/test_perfect_matchings.py
  • toqito/perms/tests/test_permute_systems.py
  • toqito/states/tests/test_singlet.py
  • toqito/state_metrics/tests/test_bures_distance.py
  • toqito/state_props/tests/test_is_mutually_orthogonal.py
  • toqito/matrix_props/tests/test_is_positive_definite.py
  • toqito/state_ops/tests/test_pure_to_mixed.py
  • toqito/matrix_props/tests/test_is_positive_semidefinite.py
  • toqito/matrix_props/tests/test_sk_norm.py
  • toqito/matrices/tests/test_gen_gell_mann.py
  • toqito/matrices/tests/test_gen_pauli.py
  • toqito/states/tests/test_gisin.py
  • toqito/states/tests/test_max_entangled.py
  • toqito/matrices/tests/test_cyclic_permutation.py
  • toqito/state_props/tests/test_is_pure.py
  • toqito/state_props/tests/test_von_neumann_entropy.py
  • toqito/states/tests/test_w_state.py
  • toqito/matrix_props/tests/test_is_square.py
  • toqito/perms/tests/test_swap_operator.py
  • toqito/matrices/tests/test_pauli.py
  • toqito/matrix_props/tests/test_trace_norm.py
  • toqito/matrix_ops/tests/test_unvec.py
  • toqito/matrices/tests/test_gell_mann.py
  • toqito/state_props/tests/test_is_separable.py
  • toqito/states/tests/test_chessboard.py
  • toqito/matrix_props/tests/test_is_commuting.py
  • toqito/matrices/tests/test_hadamard.py
  • toqito/perms/tests/test_symmetric_projection.py
  • toqito/state_props/tests/test_is_ensemble.py
  • toqito/channels/tests/test_partial_transpose.py
  • toqito/state_props/tests/test_schmidt_rank.py
  • toqito/state_metrics/tests/test_hilbert_schmidt.py
  • toqito/state_props/tests/test_is_mixed.py
  • toqito/helper/tests/test_cvx_kron.py
  • toqito/channels/tests/test_reduction.py
  • toqito/matrix_ops/tests/test_vec.py
  • toqito/matrix_props/tests/test_is_permutation.py
  • Remove np.testing from test_update_odometer.py #546
@Shivansh20128
Copy link
Contributor

Hey @vprusso , if I want to work on this, do I need to create an issue for each of these? I think the fixes are similar for many of them and I can remove np.testing from many of the test files in a single go. How can I move forward?

@vprusso
Copy link
Owner

vprusso commented Nov 5, 2024

Hi @Shivansh20128 ,

I'm wondering whether this issue is actually needed. I'm not particularly convinced that replacing everything with pytest would be the way to go or whether not using np.testing is advantageous. There is also a fair amount of work in doing this, so I wonder whether it's worth the effort.

From doing some more digging, I'm getting the sense that pytest and np.testing are complimentary and I don't personally see the need to shift from one to the other. But as @purva-thakre wrote this issue up, maybe she has some input on the matter that I don't.

Thank you as always for your enthusiasm and interest in working on toqito!

@Shivansh20128
Copy link
Contributor

Okay. Let me know when if its needed.

@vprusso
Copy link
Owner

vprusso commented Nov 5, 2024

Okay. Let me know when if its needed.

Will do, @Shivansh20128 !

In the meantime, I'll be putting up some more issues on the board. If you see anything that interests you, or if you have any issues that you think would make toqito better, by all means, put them up on the board! I'm sure given your experience with contributions, you could offer some valuable suggestions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed pytest
Projects
None yet
Development

No branches or pull requests

3 participants