コード例 #1
0
ファイル: test_template_assertions.py プロジェクト: dexy/dexy
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'"
コード例 #2
0
ファイル: test_template_assertions.py プロジェクト: dexy/dexy
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"
コード例 #3
0
ファイル: test_template_assertions.py プロジェクト: dexy/dexy
def test_assert_matches():
    assert str(run_jinja_filter(
        "{{ 'foo bar baz' | assert_matches('^foo') }}")) == 'foo bar baz'
コード例 #4
0
ファイル: test_template_assertions.py プロジェクト: dexy/dexy
def test_assert_equals():
    assert str(run_jinja_filter("{{ 'foo' | assert_equals('foo') }}")) == 'foo'
コード例 #5
0
ファイル: test_template_assertions.py プロジェクト: dexy/dexy
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'"
コード例 #6
0
ファイル: test_template_assertions.py プロジェクト: dexy/dexy
def test_assert_startswith():
    assert str(run_jinja_filter(
        "{{ 'foo bar' | assert_startswith('foo') }}")) == 'foo bar'
コード例 #7
0
ファイル: test_template_assertions.py プロジェクト: dexy/dexy
def test_assert_does_not_contain():
    assert str(
        run_jinja_filter(
            "{{ 'foo bar' | assert_does_not_contain('baz') }}")) == 'foo bar'
コード例 #8
0
ファイル: test_template_assertions.py プロジェクト: dexy/dexy
def test_assert_contains():
    assert str(run_jinja_filter(
        "{{ 'foo bar' | assert_contains('foo') }}")) == 'foo bar'
コード例 #9
0
ファイル: test_template_assertions.py プロジェクト: dexy/dexy
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'"
コード例 #10
0
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'"