Esempio n. 1
0
def test_ds9_openlist(run_ds9s):
    '''ds9_openlist returns running ds9 instances'''
    names = ['test1', 'test1', 'test2']
    with run_ds9s(*names):
        ds9s = pyds9.ds9_openlist()

    target_is_id = [ds9.target == ds9.id for ds9 in ds9s]

    assert len(ds9s) == len(names)
    assert sum(target_is_id) == 2
Esempio n. 2
0
def test_ds9_openlist(run_ds9s):
    '''ds9_openlist returns running ds9 instances'''
    names = ['test1', 'test1', 'test2']
    with run_ds9s(*names):
        ds9s = pyds9.ds9_openlist()

    target_is_id = [ds9.target == ds9.id for ds9 in ds9s]

    assert len(ds9s) == len(names)
    assert sum(target_is_id) == 2
Esempio n. 3
0
def test_ds9_openlist(run_ds9s):
    '''ds9_openlist returns running ds9 instances'''
    names = ['test4', 'test5', 'test6']
    with run_ds9s(*names):
        ds9s = pyds9.ds9_openlist()

    assert len(ds9s) == len(names)

    # It is not obvious to DJB what this test was meant to do
    # since the .target and .id field values are very different.
    #
    # target_is_id = [ds9.target == ds9.id for ds9 in ds9s]
    # assert sum(target_is_id) == 2

    # I have replaced them by a simple set check that the
    # expected names are returned.
    #
    expected = {"DS9:" + n for n in names}
    got = {d.target for d in ds9s}
    assert expected == got
Esempio n. 4
0
def ds9_obj(ds9_title):
    '''returns the DS9 instance for ``ds9_title``'''
    return pyds9.ds9_openlist(target='*' + ds9_title + '*')[0]
Esempio n. 5
0
def test_ds9_openlist_empty():
    '''If no ds9 instance is running, ds9_openlist raises an exception'''
    with pytest.raises(ValueError,
                       match='no active ds9 found for target: DS9:*'):
        pyds9.ds9_openlist()
Esempio n. 6
0
def test_ds9_openlist(ds9_title):
    '''ds9_openlist returns running ds9 instances'''
    ds9s = pyds9.ds9_openlist()
    assert len(ds9s) == 1
    assert ds9_title in ds9s[0].target
Esempio n. 7
0
def test_ds9_openlist_empty():
    '''If no ds9 instance is running, ds9_openlist raises an exception'''
    pyds9.ds9_openlist()
Esempio n. 8
0
def ds9_obj(ds9_title):
    '''returns the DS9 instance for ``ds9_title``'''
    return pyds9.ds9_openlist(target='*' + ds9_title + '*')[0]
Esempio n. 9
0
def test_ds9_openlist_empty():
    '''If no ds9 instance is running, ds9_openlist raises an exception'''
    pyds9.ds9_openlist()