예제 #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
예제 #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
예제 #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
예제 #4
0
def ds9_obj(ds9_title):
    '''returns the DS9 instance for ``ds9_title``'''
    return pyds9.ds9_openlist(target='*' + ds9_title + '*')[0]
예제 #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()
예제 #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
예제 #7
0
def test_ds9_openlist_empty():
    '''If no ds9 instance is running, ds9_openlist raises an exception'''
    pyds9.ds9_openlist()
예제 #8
0
def ds9_obj(ds9_title):
    '''returns the DS9 instance for ``ds9_title``'''
    return pyds9.ds9_openlist(target='*' + ds9_title + '*')[0]
예제 #9
0
def test_ds9_openlist_empty():
    '''If no ds9 instance is running, ds9_openlist raises an exception'''
    pyds9.ds9_openlist()