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)
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()
def test_no_loaded_files_exception(): with pytest.raises(spice.stypes.SpiceyError): spice.ckgp(0, 0, 0, "blah") spice.reset() with pytest.raises(spice.stypes.NotFoundError): spice.ckgp(0, 0, 0, "blah") spice.reset() with spice.no_found_check(): with pytest.raises(spice.stypes.SpiceyPyIOError): spice.ckgp(0, 0, 0, "blah") spice.reset() with pytest.raises(spice.exceptions.SpiceNOLOADEDFILES): spice.ckgp(0, 0, 0, "blah") spice.reset()