Passed
Push — master ( 09ff5f...b15547 )
by
unknown
01:45
created

tests.test_exceptions   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 11
dl 0
loc 22
rs 10
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A test_undefined_variable_to_str() 0 15 1
1
"""Collection of tests around general exception handling."""
2
from jinja2.exceptions import UndefinedError
3
4
from cookiecutter import exceptions
5
6
7
def test_undefined_variable_to_str():
8
    """Verify string representation of errors formatted in expected form."""
9
    undefined_var_error = exceptions.UndefinedVariableInTemplate(
10
        'Beautiful is better than ugly',
11
        UndefinedError('Errors should never pass silently'),
12
        {'cookiecutter': {'foo': 'bar'}},
13
    )
14
15
    expected_str = (
16
        "Beautiful is better than ugly. "
17
        "Error message: Errors should never pass silently. "
18
        "Context: {'cookiecutter': {'foo': 'bar'}}"
19
    )
20
21
    assert str(undefined_var_error) == expected_str
22