How to use the permuta.Perm.from_iterable_validated function in permuta

To help you get started, we’ve selected a few permuta examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PermutaTriangle / Permuta / tests / patterns / test_perm.py View on Github external
with pytest.raises(TypeError):
        Perm.from_iterable_validated(101)
    with pytest.raises(TypeError):
        Perm.from_iterable_validated(-234)
    with pytest.raises(TypeError):
        Perm.from_iterable_validated(None)
    with pytest.raises(TypeError):
        Perm.from_iterable_validated([0.1, 0.2, 0.3])
    with pytest.raises(ValueError):
        Perm.from_iterable_validated("132")
    with pytest.raises(ValueError):
        Perm.from_iterable_validated("134")
    with pytest.raises(ValueError):
        Perm.from_iterable_validated("112")
    with pytest.raises(ValueError):
        Perm.from_iterable_validated("5")
    try:
        Perm.from_iterable_validated(())
        Perm.from_iterable_validated((1, 0))
        Perm.from_iterable_validated([5, 1, 0, 2, 4, 3])
        Perm.from_iterable_validated("1302")
    except (ValueError, TypeError):
        pytest.fail("Exception raised when it shouldn't")
github PermutaTriangle / Permuta / tests / patterns / test_perm.py View on Github external
Perm.from_iterable_validated(None)
    with pytest.raises(TypeError):
        Perm.from_iterable_validated([0.1, 0.2, 0.3])
    with pytest.raises(ValueError):
        Perm.from_iterable_validated("132")
    with pytest.raises(ValueError):
        Perm.from_iterable_validated("134")
    with pytest.raises(ValueError):
        Perm.from_iterable_validated("112")
    with pytest.raises(ValueError):
        Perm.from_iterable_validated("5")
    try:
        Perm.from_iterable_validated(())
        Perm.from_iterable_validated((1, 0))
        Perm.from_iterable_validated([5, 1, 0, 2, 4, 3])
        Perm.from_iterable_validated("1302")
    except (ValueError, TypeError):
        pytest.fail("Exception raised when it shouldn't")
github PermutaTriangle / Permuta / tests / patterns / test_perm.py View on Github external
with pytest.raises(ValueError):
        Perm.from_iterable_validated([0, 0])
    with pytest.raises(ValueError):
        Perm.from_iterable_validated([1])
    with pytest.raises(ValueError):
        Perm.from_iterable_validated((1,))
    with pytest.raises(TypeError):
        Perm.from_iterable_validated(101)
    with pytest.raises(TypeError):
        Perm.from_iterable_validated(-234)
    with pytest.raises(TypeError):
        Perm.from_iterable_validated(None)
    with pytest.raises(TypeError):
        Perm.from_iterable_validated([0.1, 0.2, 0.3])
    with pytest.raises(ValueError):
        Perm.from_iterable_validated("132")
    with pytest.raises(ValueError):
        Perm.from_iterable_validated("134")
    with pytest.raises(ValueError):
        Perm.from_iterable_validated("112")
    with pytest.raises(ValueError):
        Perm.from_iterable_validated("5")
    try:
        Perm.from_iterable_validated(())
        Perm.from_iterable_validated((1, 0))
        Perm.from_iterable_validated([5, 1, 0, 2, 4, 3])
        Perm.from_iterable_validated("1302")
    except (ValueError, TypeError):
        pytest.fail("Exception raised when it shouldn't")
github PermutaTriangle / Permuta / tests / patterns / test_perm.py View on Github external
with pytest.raises(ValueError):
        Perm.from_iterable_validated([0, 1, 1])
    with pytest.raises(ValueError):
        Perm.from_iterable_validated([1, 0, 1])
    with pytest.raises(ValueError):
        Perm.from_iterable_validated([0, 0])
    with pytest.raises(ValueError):
        Perm.from_iterable_validated([1])
    with pytest.raises(ValueError):
        Perm.from_iterable_validated((1,))
    with pytest.raises(TypeError):
        Perm.from_iterable_validated(101)
    with pytest.raises(TypeError):
        Perm.from_iterable_validated(-234)
    with pytest.raises(TypeError):
        Perm.from_iterable_validated(None)
    with pytest.raises(TypeError):
        Perm.from_iterable_validated([0.1, 0.2, 0.3])
    with pytest.raises(ValueError):
        Perm.from_iterable_validated("132")
    with pytest.raises(ValueError):
        Perm.from_iterable_validated("134")
    with pytest.raises(ValueError):
        Perm.from_iterable_validated("112")
    with pytest.raises(ValueError):
        Perm.from_iterable_validated("5")
    try:
        Perm.from_iterable_validated(())
        Perm.from_iterable_validated((1, 0))
        Perm.from_iterable_validated([5, 1, 0, 2, 4, 3])
        Perm.from_iterable_validated("1302")
    except (ValueError, TypeError):
github PermutaTriangle / Permuta / tests / patterns / test_perm.py View on Github external
def test_from_iterable_validated():
    with pytest.raises(ValueError):
        Perm.from_iterable_validated([0, 1, 1])
    with pytest.raises(ValueError):
        Perm.from_iterable_validated([1, 0, 1])
    with pytest.raises(ValueError):
        Perm.from_iterable_validated([0, 0])
    with pytest.raises(ValueError):
        Perm.from_iterable_validated([1])
    with pytest.raises(ValueError):
        Perm.from_iterable_validated((1,))
    with pytest.raises(TypeError):
        Perm.from_iterable_validated(101)
    with pytest.raises(TypeError):
        Perm.from_iterable_validated(-234)
    with pytest.raises(TypeError):
        Perm.from_iterable_validated(None)
    with pytest.raises(TypeError):
        Perm.from_iterable_validated([0.1, 0.2, 0.3])
github PermutaTriangle / Permuta / tests / patterns / test_perm.py View on Github external
with pytest.raises(ValueError):
        Perm.from_iterable_validated([1])
    with pytest.raises(ValueError):
        Perm.from_iterable_validated((1,))
    with pytest.raises(TypeError):
        Perm.from_iterable_validated(101)
    with pytest.raises(TypeError):
        Perm.from_iterable_validated(-234)
    with pytest.raises(TypeError):
        Perm.from_iterable_validated(None)
    with pytest.raises(TypeError):
        Perm.from_iterable_validated([0.1, 0.2, 0.3])
    with pytest.raises(ValueError):
        Perm.from_iterable_validated("132")
    with pytest.raises(ValueError):
        Perm.from_iterable_validated("134")
    with pytest.raises(ValueError):
        Perm.from_iterable_validated("112")
    with pytest.raises(ValueError):
        Perm.from_iterable_validated("5")
    try:
        Perm.from_iterable_validated(())
        Perm.from_iterable_validated((1, 0))
        Perm.from_iterable_validated([5, 1, 0, 2, 4, 3])
        Perm.from_iterable_validated("1302")
    except (ValueError, TypeError):
        pytest.fail("Exception raised when it shouldn't")
github PermutaTriangle / Permuta / permuta / cli.py View on Github external
def parse_basis(args):
    basis = []
    for perm_str in args.basis.split("_"):
        perm_tuple = tuple(map(int, perm_str))
        if 0 not in perm_tuple:
            perm_tuple = tuple(i - 1 for i in perm_tuple)
        perm = Perm.from_iterable_validated(perm_tuple)
        basis.append(perm)
    return basis