question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

test_exhaustive_symmetrization_1q failure in test_operator_estimation.py

See original GitHub issue

test_exhaustive_symmetrization_1q failed when run by semaphoreci for PR #925.

=================================== FAILURES ===================================
______________________ test_exhaustive_symmetrization_1q _______________________

forest = <pyquil.api._base_connection.ForestConnection object at 0x7f6957ab6eb8>

    def test_exhaustive_symmetrization_1q(forest):
        qc = get_qc('9q-qvm')
        qubs = [5]
        n_shots = 2000
        p = Program()
        p00, p11 = 0.90, 0.80
        p.define_noisy_readout(5, p00, p11)
        bs_results, d_qub_idx = _exhaustive_symmetrization(qc, qubs, n_shots, p)
        frac0 = np.count_nonzero(bs_results == 0) / n_shots
        expected_frac0 = (p00 + p11) / 2
    
        assert d_qub_idx == {5: 0}
>       assert np.isclose(frac0, expected_frac0, 2e-2)
E       assert False
E        +  where False = <function isclose at 0x7f6966899a60>(0.8785, 0.8500000000000001, 0.02)
E        +    where <function isclose at 0x7f6966899a60> = np.isclose

pyquil/tests/test_operator_estimation.py:758: AssertionError

Here is a Python repl session replicating the above np.isclose calculation, according to the numpy docs. The last line is meant to show how close/far the test was from passing.

>>> import numpy as np
>>> a = 0.8785
>>> b = 0.8500000000000001
>>> atol = 1e-08
>>> rtol = 2e-2
>>> np.isclose(a, b, rtol)
False
>>> abs(a - b)
0.02849999999999986
>>> atol + rtol * b
0.017000010000000003
>>> abs(a-b) - (atol + rtol * b)
0.011499989999999856

Link to the semaphoreci logs is here: https://semaphoreci.com/rigetti/pyquil/branches/pull-request-925/builds/1

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ecpetersoncommented, Jun 20, 2019

The remote test runner also just passed.

0reactions
karalekascommented, Jul 23, 2019

Addressed in #928

Read more comments on GitHub >

github_iconTop Results From Across the Web

long running py.test stop at first failure - Stack Overflow
I am using pytest , and the test execution is supposed to run until it encounters an exception. If the test never encounters...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found