Example #1
0
def test_assert_does_not_contain_invalid():
    try:
        str(
            run_jinja_filter(
                "{{ 'foo bar baz' | assert_does_not_contain('baz') }}"))
        raise Exception("should raise AssertionError")
    except AssertionError as e:
        assert str(e) == "input text contained 'baz'"
Example #2
0
def test_assert_matches_invalid():
    try:
        str(run_jinja_filter("{{ 'foo bar' | assert_matches('^baz') }}"))
        raise Exception("should raise AssertionError")
    except AssertionError as e:
        assert str(e) == "input text did not match regexp ^baz"
Example #3
0
def test_assert_matches():
    assert str(run_jinja_filter(
        "{{ 'foo bar baz' | assert_matches('^foo') }}")) == 'foo bar baz'
Example #4
0
def test_assert_equals():
    assert str(run_jinja_filter("{{ 'foo' | assert_equals('foo') }}")) == 'foo'
Example #5
0
def test_assert_startswith_invalid():
    try:
        str(run_jinja_filter("{{ 'foo bar' | assert_startswith('bar') }}"))
        raise Exception("should raise AssertionError")
    except AssertionError as e:
        assert str(e) == "input text did not start with 'bar'"
Example #6
0
def test_assert_startswith():
    assert str(run_jinja_filter(
        "{{ 'foo bar' | assert_startswith('foo') }}")) == 'foo bar'
Example #7
0
def test_assert_does_not_contain():
    assert str(
        run_jinja_filter(
            "{{ 'foo bar' | assert_does_not_contain('baz') }}")) == 'foo bar'
Example #8
0
def test_assert_contains():
    assert str(run_jinja_filter(
        "{{ 'foo bar' | assert_contains('foo') }}")) == 'foo bar'
Example #9
0
def test_assert_equals_invalid():
    try:
        str(run_jinja_filter("{{ 'foo' | assert_equals('bar') }}"))
        raise Exception("should raise AssertionError")
    except AssertionError as e:
        assert str(e) == "input text did not equal 'bar'"
def test_assert_contains_invalid():
    try:
        unicode(run_jinja_filter("{{ 'foo bar' | assert_contains('baz') }}"))
        raise Exception("should raise AssertionError")
    except AssertionError as e:
        assert str(e) == "input text did not contain 'baz'"