def test_parse_qc_strip():
    # Originally used `str.strip` to remove the suffixes. This is not correct!
    name, _, _ = _parse_name("mvq-qvm", None, None)
    assert name == 'mvq'

    name, _, _ = _parse_name("mvq-noisy-qvm", None, None)
    assert name == 'mvq'
def test_parse_qc_conflicting():
    with pytest.raises(ValueError) as e:
        name, qvm_type, noisy = _parse_name('9q-generic-qvm', False, False)

    assert e.match(r'.*but you have specified `as_qvm=False`')

    with pytest.raises(ValueError) as e:
        name, qvm_type, noisy = _parse_name('9q-generic-noisy-qvm', True, False)
    assert e.match(r'.*but you have specified `noisy=False`')
def test_parse_qc_no_prefix_2():
    prefix, qvm_type, noisy = _parse_name('noisy-qvm', None, None)
    assert qvm_type == 'qvm'
    assert noisy
    assert prefix == ''

    prefix, qvm_type, noisy = _parse_name('', True, True)
    assert qvm_type == 'qvm'
    assert noisy
    assert prefix == ''
Exemple #4
0
def test_parse_qc_no_prefix_2():
    prefix, as_qvm, noisy = _parse_name('noisy-qvm', None, None)
    assert as_qvm
    assert noisy
    assert prefix == ''

    prefix, as_qvm, noisy = _parse_name('', True, True)
    assert as_qvm
    assert noisy
    assert prefix == ''
def test_parse_qc_no_prefix_2():
    prefix, qvm_type, noisy = _parse_name("noisy-qvm", None, None)
    assert qvm_type == "qvm"
    assert noisy
    assert prefix == ""

    prefix, qvm_type, noisy = _parse_name("", True, True)
    assert qvm_type == "qvm"
    assert noisy
    assert prefix == ""
def test_parse_qc_redundant():
    name, qvm_type, noisy = _parse_name('9q-generic', False, False)
    assert name == '9q-generic'
    assert qvm_type is None
    assert not noisy

    name, qvm_type, noisy = _parse_name('9q-generic-qvm', True, False)
    assert name == '9q-generic'
    assert qvm_type == 'qvm'
    assert not noisy

    name, qvm_type, noisy = _parse_name('9q-generic-noisy-qvm', True, True)
    assert name == '9q-generic'
    assert qvm_type == 'qvm'
    assert noisy
def test_parse_qc_flags():
    name, qvm_type, noisy = _parse_name('9q-generic', False, False)
    assert name == '9q-generic'
    assert qvm_type is None
    assert not noisy

    name, qvm_type, noisy = _parse_name('9q-generic', True, None)
    assert name == '9q-generic'
    assert qvm_type == 'qvm'
    assert not noisy

    name, qvm_type, noisy = _parse_name('9q-generic', True, True)
    assert name == '9q-generic'
    assert qvm_type == 'qvm'
    assert noisy
def test_parse_qc_name():
    name, qvm_type, noisy = _parse_name('9q-generic', None, None)
    assert name == '9q-generic'
    assert qvm_type is None
    assert not noisy

    name, qvm_type, noisy = _parse_name('9q-generic-qvm', None, None)
    assert name == '9q-generic'
    assert qvm_type == 'qvm'
    assert not noisy

    name, qvm_type, noisy = _parse_name('9q-generic-noisy-qvm', None, None)
    assert name == '9q-generic'
    assert qvm_type == 'qvm'
    assert noisy
Exemple #9
0
def test_parse_qc_flags():
    name, as_qvm, noisy = _parse_name('9q-generic', False, False)
    assert name == '9q-generic'
    assert not as_qvm
    assert not noisy

    name, as_qvm, noisy = _parse_name('9q-generic', True, None)
    assert name == '9q-generic'
    assert as_qvm
    assert not noisy

    name, as_qvm, noisy = _parse_name('9q-generic', True, True)
    assert name == '9q-generic'
    assert as_qvm
    assert noisy
def test_parse_qc_redundant():
    name, qvm_type, noisy = _parse_name("9q-generic", False, False)
    assert name == "9q-generic"
    assert qvm_type is None
    assert not noisy

    name, qvm_type, noisy = _parse_name("9q-generic-qvm", True, False)
    assert name == "9q-generic"
    assert qvm_type == "qvm"
    assert not noisy

    name, qvm_type, noisy = _parse_name("9q-generic-noisy-qvm", True, True)
    assert name == "9q-generic"
    assert qvm_type == "qvm"
    assert noisy
def test_parse_qc_flags():
    name, qvm_type, noisy = _parse_name("9q-generic", False, False)
    assert name == "9q-generic"
    assert qvm_type is None
    assert not noisy

    name, qvm_type, noisy = _parse_name("9q-generic", True, None)
    assert name == "9q-generic"
    assert qvm_type == "qvm"
    assert not noisy

    name, qvm_type, noisy = _parse_name("9q-generic", True, True)
    assert name == "9q-generic"
    assert qvm_type == "qvm"
    assert noisy
def test_parse_qc_name():
    name, qvm_type, noisy = _parse_name("9q-generic", None, None)
    assert name == "9q-generic"
    assert qvm_type is None
    assert not noisy

    name, qvm_type, noisy = _parse_name("9q-generic-qvm", None, None)
    assert name == "9q-generic"
    assert qvm_type == "qvm"
    assert not noisy

    name, qvm_type, noisy = _parse_name("9q-generic-noisy-qvm", None, None)
    assert name == "9q-generic"
    assert qvm_type == "qvm"
    assert noisy
Exemple #13
0
def test_parse_qc_redundant():
    name, as_qvm, noisy = _parse_name('9q-generic', False, False)
    assert name == '9q-generic'
    assert not as_qvm
    assert not noisy

    name, as_qvm, noisy = _parse_name('9q-generic-qvm', True, False)
    assert name == '9q-generic'
    assert as_qvm
    assert not noisy

    name, as_qvm, noisy = _parse_name('9q-generic-noisy-qvm', True, True)
    assert name == '9q-generic'
    assert as_qvm
    assert noisy
Exemple #14
0
def test_parse_qc_name():
    name, as_qvm, noisy = _parse_name('9q-generic', None, None)
    assert name == '9q-generic'
    assert not as_qvm
    assert not noisy

    name, as_qvm, noisy = _parse_name('9q-generic-qvm', None, None)
    assert name == '9q-generic'
    assert as_qvm
    assert not noisy

    name, as_qvm, noisy = _parse_name('9q-generic-noisy-qvm', None, None)
    assert name == '9q-generic'
    assert as_qvm
    assert noisy
def test_parse_qc_pyqvm():
    prefix, qvm_type, noisy = _parse_name('9q-generic-pyqvm', None, None)
    assert prefix == '9q-generic'
    assert qvm_type == 'pyqvm'
    assert not noisy
def test_parse_mix_qvm_and_noisy_flag():
    # https://github.com/rigetti/pyquil/issues/764
    name, qvm_type, noisy = _parse_name('1q-qvm', as_qvm=None, noisy=True)
    assert noisy
def test_parse_qc_pyqvm():
    prefix, qvm_type, noisy = _parse_name("9q-generic-pyqvm", None, None)
    assert prefix == "9q-generic"
    assert qvm_type == "pyqvm"
    assert not noisy