コード例 #1
0
ファイル: test_spiceerrors.py プロジェクト: zhangqrl/SpiceyPy
def test_disable_found_catch():
    spice.kclear()
    with spice.no_found_check():
        name, found = spice.bodc2n(-9991)
        assert not found
    with pytest.raises(spice.stypes.SpiceyError):
        spice.bodc2n(-9991)
    # try more hands on method
    spice.found_check_off()
    name, found = spice.bodc2n(-9991)
    assert not found
    spice.found_check_on()
    spice.kclear()
コード例 #2
0
ファイル: test_spiceerrors.py プロジェクト: zhangqrl/SpiceyPy
def test_found_check():
    spice.kclear()
    spice.found_check_off()
    name, found = spice.bodc2n(-9991)
    assert not found
    spice.kclear()
    with spice.found_check():
        with pytest.raises(spice.stypes.SpiceyError):
            name = spice.bodc2n(-9991)
    assert not spice.get_found_catch_state()
    spice.found_check_on()
    assert spice.get_found_catch_state()
    spice.kclear()
コード例 #3
0
ファイル: test_spiceerrors.py プロジェクト: n-dutta/SpiceyPy
def test_recursive_disable_found_catch():
    spice.kclear()
    assert spice.config.catch_false_founds
    def _recursive_call(i):
        if i <= 0:
            return
        else:
            with spice.no_found_check():
                name, found = spice.bodc2n(-9991)
                assert not found
                _recursive_call(i-1)
    assert spice.config.catch_false_founds
    _recursive_call(100)
    spice.kclear()
    spice.found_check_off()
    _recursive_call(100)
    spice.kclear()
    spice.found_check_on()
    _recursive_call(100)
    spice.kclear()