TeamGraphix / graphix

measurement-based quantum computing (MBQC) compiler and simulator
https://graphix.readthedocs.io
Apache License 2.0
55 stars 20 forks source link

[Bug]: Some tests are broken if seed is changed #130

Closed thierry-martinez closed 1 month ago

thierry-martinez commented 2 months ago

Bug description The following tests are broken when tested with a different seed:

To Reproduce The failures in test_pattern.py can be observed by adding

+        rc.set_seed(25)

in the beginning of the method test_pauli_measurment_opt_gate (changing the SEED value in the beginning of the file will not change the behavior, since the seed value is overridden by other tests).

The failure in test_gflow.py can be observed by changing the value of seed in the beginning of the file.

-seed = 30
+seed = 25

Expected behavior Changing the seed should not break the tests.

Environment (please complete the following information):

Additional context I noticed these failures in an effort to address https://github.com/TeamGraphix/graphix/issues/65

EarlMilktea commented 2 months ago

I also encountered it.

masa10-f commented 1 month ago

@shinich1 Have you checked the test_gflow.py::test_rand_circ_gflow ?

shinich1 commented 1 month ago

@shinich1 Have you checked the test_gflow.py::test_rand_circ_gflow ?

Actually, test passed without any fix on my side (I removed the skip command and changed the seed when trying). Somehow I haven't pushed it but we need to remove this line. https://github.com/TeamGraphix/graphix/blob/19eb94cabccf0ca9f9ad2b765a2f2bfbf65bba93/tests/test_gflow.py#L510