Esempio n. 1
0
def test_get_default_id():
    """Does the default id react correctly?"""
    s = Session()
    assert s.get_default_id() == 1

    s.set_default_id('alpha')
    assert s.get_default_id() == 'alpha'
Esempio n. 2
0
def test_error_estimate_not_run(name):
    """Can not rn the error estimate if data is not set up"""

    s = Session()
    s.set_default_id('bob')
    func = getattr(s, name)

    with pytest.raises(IdentifierErr) as exc:
        func()

    assert str(exc.value) == "data set bob has not been set"
Esempio n. 3
0
def test_set_default_id_check_invalid(value):
    """Check we error out with an invalid id.

    There are other checks of this logic, but not as simple
    as this. The test in
    sherpa/astro/ui/tests/test_astro_session.py::test_id_checks_astro_session
    adds a test for astro-specific keywords.

    """

    s = Session()

    with pytest.raises(IdentifierErr) as err:
        s.set_default_id(value)

    assert str(err.value) == f"identifier '{value}' is a reserved word"