Pārlūkot izejas kodu

Skip tests that depend on the original C++

I have written a tonne of tests that compare against A&B's original C++.
Until I can distribute the `anders_briegel` package which implements
that original code, we now skip those tests if we see an ImportError.

TODO: seems a little over-zealous right now ...
master
Pete Shadbolt pirms 8 gadiem
vecāks
revīzija
bf22c0f5e7
5 mainītis faili ar 14 papildinājumiem un 6 dzēšanām
  1. +5
    -1
      tests/mock.py
  2. +0
    -1
      tests/test_against_anders_and_briegel.py
  3. +7
    -1
      tests/test_clifford.py
  4. +0
    -1
      tests/test_measurement.py
  5. +2
    -2
      tests/test_qi.py

+ 5
- 1
tests/mock.py Parādīt failu

@@ -4,8 +4,12 @@ Mock graphs used for testing

import numpy as np
from abp import GraphState, clifford, qi
from anders_briegel import graphsim
from numpy import random
import nose
try:
from anders_briegel import graphsim
except ImportError:
raise nose.SkipTest("Original C++ is not available, skipping test")

# We always run with A&B's CZ table when we are testing
clifford.use_old_cz()


+ 0
- 1
tests/test_against_anders_and_briegel.py Parādīt failu

@@ -1,5 +1,4 @@
from abp import GraphState, CircuitModel, clifford
from anders_briegel import graphsim
import numpy as np
from numpy import random
from tqdm import tqdm


+ 7
- 1
tests/test_clifford.py Parādīt failu

@@ -4,8 +4,8 @@ import itertools as it
from abp import clifford
from abp import build_tables
from abp import qi
import nose
from nose.tools import raises
from anders_briegel import graphsim


def identify_pauli(m):
@@ -79,6 +79,12 @@ def test_commuters():

def test_conjugation():
""" Test that clifford.conugate() agrees with graphsim.LocCliffOp.conjugate """
try:
from anders_briegel import graphsim
except ImportError:
raise nose.SkipTest("Original C++ is not available, skipping test")

for operation_index, transform_index in it.product(range(4), range(24)):
transform = graphsim.LocCliffOp(transform_index)
operation = graphsim.LocCliffOp(operation_index)


+ 0
- 1
tests/test_measurement.py Parādīt failu

@@ -1,7 +1,6 @@
import numpy as np
from abp import GraphState
from abp import qi, clifford
from anders_briegel import graphsim
from tqdm import tqdm
import random
import itertools as it


+ 2
- 2
tests/test_qi.py Parādīt failu

@@ -2,6 +2,7 @@ import numpy as np
from abp import qi, GraphState
from tqdm import tqdm
import mock
import nose

DEPTH = 1000

@@ -126,8 +127,7 @@ def test_against_chp(n=5):
try:
import chp
except ImportError:
print "Not testing against CHP -- not installed"
return
raise nose.SkipTest("CHP is not installed")

def get_chp_state():
""" Helper to convert CHP to CircuitModel """


Notiek ielāde…
Atcelt
Saglabāt