예제 #1
0
def test_geterror():
    spice.setmsg("some error occured")
    spice.sigerr("error")
    assert spice.failed()
    assert spice.getmsg("SHORT", 40) == "error"
    assert spice.getmsg("LONG", 200) == "some error occured"
    spice.reset()
예제 #2
0
def test_found_error_checker():
    with pytest.raises((
            spice.exceptions.SpiceyError,
            spice.exceptions.SpiceyPyError,
            spice.exceptions.NotFoundError,
    )):
        spice.bodc2n(-9991)
    spice.reset()
예제 #3
0
def test_get_spiceypy_exceptions():
    with pytest.raises((
            spice.exceptions.SpiceyError,
            spice.exceptions.SpiceyPyError,
            spice.exceptions.SpiceyPyIOError,
    )):
        spice.furnsh(os.path.join(cwd, "_null_kernel.txt"))
    spice.reset()
예제 #4
0
def test_SpiceEllipse():
    spice.kclear()
    spice.reset()
    viewpt = [2.0, 0.0, 0.0]
    limb = spice.edlimb(np.sqrt(2), 2.0 * np.sqrt(2), np.sqrt(2), viewpt)
    expected_s_minor = [0.0, 0.0, -1.0]
    expected_s_major = [0.0, 2.0, 0.0]
    expectedCenter = [1.0, 0.0, 0.0]
    npt.assert_array_almost_equal(limb.center, expectedCenter)
    npt.assert_array_almost_equal(limb.semi_major, expected_s_major)
    npt.assert_array_almost_equal(limb.semi_minor, expected_s_minor)
    assert str(limb).startswith("<SpiceEllipse")
    spice.reset()
    spice.kclear()
예제 #5
0
def test_SpiceEllipse():
    spice.kclear()
    spice.reset()
    viewpt = [2.0, 0.0, 0.0]
    limb = spice.edlimb(np.sqrt(2), 2.0 * np.sqrt(2), np.sqrt(2), viewpt)
    expectedSMinor = [0.0, 0.0, -1.0]
    expectedSMajor = [0.0, 2.0, 0.0]
    expectedCenter = [1.0, 0.0, 0.0]
    npt.assert_array_almost_equal(limb.center, expectedCenter)
    npt.assert_array_almost_equal(limb.semi_major, expectedSMajor)
    npt.assert_array_almost_equal(limb.semi_minor, expectedSMinor)
    assert str(limb).startswith("<SpiceEllipse")
    spice.reset()
    spice.kclear()
예제 #6
0
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()
예제 #7
0
def test_foundErrorChecker():
    with pytest.raises(spice.stypes.SpiceyError):
        spice.bodc2n(-9991)
    spice.reset()
예제 #8
0
def test_emptyKernelPoolException():
    with pytest.raises(spice.stypes.SpiceyError):
        spice.ckgp(0, 0, 0, "blah")
    spice.reset()
예제 #9
0
def test_getSpiceyException():
    with pytest.raises(spice.stypes.SpiceyError):
        spice.furnsh(os.path.join(cwd, "_null_kernel.txt"))
    spice.reset()