import pytest
from ..neural.util import get_ops
from ..neural.ops import NumpyOps, CupyOps


def test_get_ops():
    Ops = get_ops('numpy')
    Ops is NumpyOps
    Ops = get_ops('cpu')
    assert Ops is NumpyOps
    Ops = get_ops('cupy')
    assert Ops is CupyOps
    Ops = get_ops('gpu')
    assert Ops is CupyOps
    with pytest.raises(ValueError):
        Ops = get_ops('blah')


@pytest.mark.xfail
@pytest.mark.parametrize(
    'ids_batch', [
        (
            (
                ('the', 'cat', 'sat'),
                ('on', 'the', 'cat')
            ),
        ),
        (
            (
                ('the',),
                ('the',)
            ),
        ),
        (
            (
                ('a', 'b', 'a', 'b', 'd', 'e', 'f'),
            ),
        )
    ]
)
def test_get_positions(ids_batch):
    ids_batch = list(toolz.concat(ids_batch))
    positions = _get_positions(ids_batch)
    for key, idxs in positions.items():
        for i in idxs:
            assert ids_batch[i] == key



@@ -380,632 +380,5 @@
 )%0A%0A%0A
-@pytest.mark.xfail%0A@pytest.mark.parametrize(%0A    'ids_batch', %5B%0A        (%0A            (%0A                ('the', 'cat', 'sat'),%0A                ('on', 'the', 'cat')%0A            ),%0A        ),%0A        (%0A            (%0A                ('the',),%0A                ('the',)%0A            ),%0A        ),%0A        (%0A            (%0A                ('a', 'b', 'a', 'b', 'd', 'e', 'f'),%0A            ),%0A        )%0A    %5D%0A)%0Adef test_get_positions(ids_batch):%0A    ids_batch = list(toolz.concat(ids_batch))%0A    positions = _get_positions(ids_batch)%0A    for key, idxs in positions.items():%0A        for i in idxs:%0A            assert ids_batch%5Bi%5D == key%0A%0A
 %0A

Remove old test