How to use the jsonmodels.utilities.is_ecma_regex function in jsonmodels

To help you get started, we’ve selected a few jsonmodels 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 jazzband / jsonmodels / tests / test_utilities.py View on Github external
with pytest.raises(ValueError):
        utilities.is_ecma_regex('/wrong regex')
    with pytest.raises(ValueError):
        utilities.is_ecma_regex('wrong regex/')
    with pytest.raises(ValueError):
        utilities.is_ecma_regex('wrong regex/gim')
    with pytest.raises(ValueError):
        utilities.is_ecma_regex('wrong regex/asdf')

    assert utilities.is_ecma_regex('/^some regex\/gim') is True

    assert utilities.is_ecma_regex('/^some regex\\\\/trololo') is True
    assert utilities.is_ecma_regex('/^some regex\\\\\/gim') is True
    assert utilities.is_ecma_regex('/\\\\/') is True

    assert utilities.is_ecma_regex('some /regex/asdf') is False
    assert utilities.is_ecma_regex('^some regex$//') is False
github jazzband / jsonmodels / tests / test_utilities.py View on Github external
def test_is_ecma_regex():
    assert utilities.is_ecma_regex('some regex') is False
    assert utilities.is_ecma_regex('^some regex$') is False
    assert utilities.is_ecma_regex('/^some regex$/') is True
    assert utilities.is_ecma_regex('/^some regex$/gim') is True
    assert utilities.is_ecma_regex('/^some regex$/trololo') is True

    with pytest.raises(ValueError):
        utilities.is_ecma_regex('/wrong regex')
    with pytest.raises(ValueError):
        utilities.is_ecma_regex('wrong regex/')
    with pytest.raises(ValueError):
        utilities.is_ecma_regex('wrong regex/gim')
    with pytest.raises(ValueError):
        utilities.is_ecma_regex('wrong regex/asdf')

    assert utilities.is_ecma_regex('/^some regex\/gim') is True

    assert utilities.is_ecma_regex('/^some regex\\\\/trololo') is True
    assert utilities.is_ecma_regex('/^some regex\\\\\/gim') is True
    assert utilities.is_ecma_regex('/\\\\/') is True
github jazzband / jsonmodels / tests / test_utilities.py View on Github external
def test_is_ecma_regex():
    assert utilities.is_ecma_regex('some regex') is False
    assert utilities.is_ecma_regex('^some regex$') is False
    assert utilities.is_ecma_regex('/^some regex$/') is True
    assert utilities.is_ecma_regex('/^some regex$/gim') is True
    assert utilities.is_ecma_regex('/^some regex$/trololo') is True

    with pytest.raises(ValueError):
        utilities.is_ecma_regex('/wrong regex')
    with pytest.raises(ValueError):
        utilities.is_ecma_regex('wrong regex/')
    with pytest.raises(ValueError):
        utilities.is_ecma_regex('wrong regex/gim')
    with pytest.raises(ValueError):
        utilities.is_ecma_regex('wrong regex/asdf')

    assert utilities.is_ecma_regex('/^some regex\/gim') is True

    assert utilities.is_ecma_regex('/^some regex\\\\/trololo') is True
    assert utilities.is_ecma_regex('/^some regex\\\\\/gim') is True
    assert utilities.is_ecma_regex('/\\\\/') is True
github jazzband / jsonmodels / tests / test_utilities.py View on Github external
def test_is_ecma_regex():
    assert utilities.is_ecma_regex('some regex') is False
    assert utilities.is_ecma_regex('^some regex$') is False
    assert utilities.is_ecma_regex('/^some regex$/') is True
    assert utilities.is_ecma_regex('/^some regex$/gim') is True
    assert utilities.is_ecma_regex('/^some regex$/trololo') is True

    with pytest.raises(ValueError):
        utilities.is_ecma_regex('/wrong regex')
    with pytest.raises(ValueError):
        utilities.is_ecma_regex('wrong regex/')
    with pytest.raises(ValueError):
        utilities.is_ecma_regex('wrong regex/gim')
    with pytest.raises(ValueError):
        utilities.is_ecma_regex('wrong regex/asdf')

    assert utilities.is_ecma_regex('/^some regex\/gim') is True

    assert utilities.is_ecma_regex('/^some regex\\\\/trololo') is True
    assert utilities.is_ecma_regex('/^some regex\\\\\/gim') is True
    assert utilities.is_ecma_regex('/\\\\/') is True

    assert utilities.is_ecma_regex('some /regex/asdf') is False
    assert utilities.is_ecma_regex('^some regex$//') is False
github jazzband / jsonmodels / tests / test_utilities.py View on Github external
assert utilities.is_ecma_regex('some regex') is False
    assert utilities.is_ecma_regex('^some regex$') is False
    assert utilities.is_ecma_regex('/^some regex$/') is True
    assert utilities.is_ecma_regex('/^some regex$/gim') is True
    assert utilities.is_ecma_regex('/^some regex$/trololo') is True

    with pytest.raises(ValueError):
        utilities.is_ecma_regex('/wrong regex')
    with pytest.raises(ValueError):
        utilities.is_ecma_regex('wrong regex/')
    with pytest.raises(ValueError):
        utilities.is_ecma_regex('wrong regex/gim')
    with pytest.raises(ValueError):
        utilities.is_ecma_regex('wrong regex/asdf')

    assert utilities.is_ecma_regex('/^some regex\/gim') is True

    assert utilities.is_ecma_regex('/^some regex\\\\/trololo') is True
    assert utilities.is_ecma_regex('/^some regex\\\\\/gim') is True
    assert utilities.is_ecma_regex('/\\\\/') is True

    assert utilities.is_ecma_regex('some /regex/asdf') is False
    assert utilities.is_ecma_regex('^some regex$//') is False
github jazzband / jsonmodels / tests / test_utilities.py View on Github external
utilities.is_ecma_regex('/wrong regex')
    with pytest.raises(ValueError):
        utilities.is_ecma_regex('wrong regex/')
    with pytest.raises(ValueError):
        utilities.is_ecma_regex('wrong regex/gim')
    with pytest.raises(ValueError):
        utilities.is_ecma_regex('wrong regex/asdf')

    assert utilities.is_ecma_regex('/^some regex\/gim') is True

    assert utilities.is_ecma_regex('/^some regex\\\\/trololo') is True
    assert utilities.is_ecma_regex('/^some regex\\\\\/gim') is True
    assert utilities.is_ecma_regex('/\\\\/') is True

    assert utilities.is_ecma_regex('some /regex/asdf') is False
    assert utilities.is_ecma_regex('^some regex$//') is False
github jazzband / jsonmodels / tests / test_utilities.py View on Github external
assert utilities.is_ecma_regex('/^some regex$/gim') is True
    assert utilities.is_ecma_regex('/^some regex$/trololo') is True

    with pytest.raises(ValueError):
        utilities.is_ecma_regex('/wrong regex')
    with pytest.raises(ValueError):
        utilities.is_ecma_regex('wrong regex/')
    with pytest.raises(ValueError):
        utilities.is_ecma_regex('wrong regex/gim')
    with pytest.raises(ValueError):
        utilities.is_ecma_regex('wrong regex/asdf')

    assert utilities.is_ecma_regex('/^some regex\/gim') is True

    assert utilities.is_ecma_regex('/^some regex\\\\/trololo') is True
    assert utilities.is_ecma_regex('/^some regex\\\\\/gim') is True
    assert utilities.is_ecma_regex('/\\\\/') is True

    assert utilities.is_ecma_regex('some /regex/asdf') is False
    assert utilities.is_ecma_regex('^some regex$//') is False
github jazzband / jsonmodels / tests / test_utilities.py View on Github external
assert utilities.is_ecma_regex('/^some regex$/') is True
    assert utilities.is_ecma_regex('/^some regex$/gim') is True
    assert utilities.is_ecma_regex('/^some regex$/trololo') is True

    with pytest.raises(ValueError):
        utilities.is_ecma_regex('/wrong regex')
    with pytest.raises(ValueError):
        utilities.is_ecma_regex('wrong regex/')
    with pytest.raises(ValueError):
        utilities.is_ecma_regex('wrong regex/gim')
    with pytest.raises(ValueError):
        utilities.is_ecma_regex('wrong regex/asdf')

    assert utilities.is_ecma_regex('/^some regex\/gim') is True

    assert utilities.is_ecma_regex('/^some regex\\\\/trololo') is True
    assert utilities.is_ecma_regex('/^some regex\\\\\/gim') is True
    assert utilities.is_ecma_regex('/\\\\/') is True

    assert utilities.is_ecma_regex('some /regex/asdf') is False
    assert utilities.is_ecma_regex('^some regex$//') is False
github jazzband / jsonmodels / tests / test_utilities.py View on Github external
def test_is_ecma_regex():
    assert utilities.is_ecma_regex('some regex') is False
    assert utilities.is_ecma_regex('^some regex$') is False
    assert utilities.is_ecma_regex('/^some regex$/') is True
    assert utilities.is_ecma_regex('/^some regex$/gim') is True
    assert utilities.is_ecma_regex('/^some regex$/trololo') is True

    with pytest.raises(ValueError):
        utilities.is_ecma_regex('/wrong regex')
    with pytest.raises(ValueError):
        utilities.is_ecma_regex('wrong regex/')
    with pytest.raises(ValueError):
        utilities.is_ecma_regex('wrong regex/gim')
    with pytest.raises(ValueError):
        utilities.is_ecma_regex('wrong regex/asdf')

    assert utilities.is_ecma_regex('/^some regex\/gim') is True

    assert utilities.is_ecma_regex('/^some regex\\\\/trololo') is True
    assert utilities.is_ecma_regex('/^some regex\\\\\/gim') is True
    assert utilities.is_ecma_regex('/\\\\/') is True

    assert utilities.is_ecma_regex('some /regex/asdf') is False
    assert utilities.is_ecma_regex('^some regex$//') is False
github jazzband / jsonmodels / tests / test_utilities.py View on Github external
def test_is_ecma_regex():
    assert utilities.is_ecma_regex('some regex') is False
    assert utilities.is_ecma_regex('^some regex$') is False
    assert utilities.is_ecma_regex('/^some regex$/') is True
    assert utilities.is_ecma_regex('/^some regex$/gim') is True
    assert utilities.is_ecma_regex('/^some regex$/trololo') is True

    with pytest.raises(ValueError):
        utilities.is_ecma_regex('/wrong regex')
    with pytest.raises(ValueError):
        utilities.is_ecma_regex('wrong regex/')
    with pytest.raises(ValueError):
        utilities.is_ecma_regex('wrong regex/gim')
    with pytest.raises(ValueError):
        utilities.is_ecma_regex('wrong regex/asdf')

    assert utilities.is_ecma_regex('/^some regex\/gim') is True