File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,6 +59,30 @@ def test_pragma_with_nested_blocks(self):
5959 )
6060 self .assert_analysis ([1 , 7 ])
6161
62+ def test_nested_if_blocks (self ):
63+ """Test that nested block of same type are handled."""
64+ self .make_template ("""\
65+ Before
66+ {% if 1 %}{# pragma: no cover #}
67+ {% if 0 %}
68+ Not covered
69+ {% endif %}
70+ Also not covered, due to parent block.
71+ {% endif %}
72+ After
73+ """ )
74+ self .run_django_coverage ()
75+ self .assert_analysis ([1 , 8 ])
76+
77+ def test_whitespace_around_pragma (self ):
78+ """Test that whitespace characters are stripped."""
79+ self .make_template ("""\
80+ Before
81+ {% load static %}{# pragma: no cover #}
82+ """ )
83+ self .run_django_coverage ()
84+ self .assert_analysis ([1 ])
85+
6286 def test_custom_exclude_patterns (self ):
6387 """Test that coverage.py config for report:exclude_lines is used."""
6488 self .make_template ("""\
You can’t perform that action at this time.
0 commit comments