コード例 #1
0
ファイル: test_dims.py プロジェクト: thewtex/napari
def test_display():
    """
    Test display setting.
    """
    dims = Dims(4)
    assert dims.display == [False] * 4

    dims.set_display(0, True)
    dims.set_display(1, True)
    assert dims.display == [True, True, False, False]

    dims._set_2d_viewing()
    assert dims.display == [False, False, True, True]
コード例 #2
0
ファイル: test_dims.py プロジェクト: thewtex/napari
def test_indices():
    """
    Test indices values.
    """
    dims = Dims(4)
    # On instantiation no dims are displayed and the indices default to 0
    assert dims.indices == (0, ) * 4

    dims._set_2d_viewing()
    # On 2D viewing the last two dims are now set to sliced mode
    assert dims.indices == (0, ) * 2 + (slice(None, None, None), ) * 2

    dims.set_point(0, 2)
    dims.set_point(1, 3)
    # Set the values of the first two dims in point mode
    assert dims.indices == (2, 3) + (slice(None, None, None), ) * 2