Exemplo n.º 1
0
def test_traversal_path():
    da = DocumentArray([Document() for _ in range(6)])
    assert len(da) == 6

    da.traverse_flat(['r'])

    with pytest.raises(ValueError):
        da.traverse_flat('r')

    da.traverse(['r'])
    with pytest.raises(ValueError):
        for _ in da.traverse('r'):
            pass

    da.traverse(['r'])
    with pytest.raises(ValueError):
        for _ in da.traverse('r'):
            pass
Exemplo n.º 2
0
def test_traversal_path():
    da = DocumentArray([Document() for _ in range(6)])
    assert len(da) == 6

    da.traverse_flat('r')

    with pytest.warns(DeprecationWarning):
        da.traverse_flat(['r'])

    da.traverse('r')
    with pytest.warns(DeprecationWarning):
        for _ in da.traverse(['r']):
            pass

    da.traverse('r')
    with pytest.warns(DeprecationWarning):
        for _ in da.traverse(['r']):
            pass