File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ {
2+ "cases" : [
3+ {
4+ "description" : " sentence without lower bound" ,
5+ "property" : " isPangram" ,
6+ "input" : {
7+ "sentence" : " bcdefghijklmnopqrstuvwxyz"
8+ },
9+ "expected" : false
10+ },
11+ {
12+ "description" : " sentence without upper bound" ,
13+ "property" : " isPangram" ,
14+ "input" : {
15+ "sentence" : " abcdefghijklmnopqrstuvwxy"
16+ },
17+ "expected" : false
18+ }
19+ ]
20+ }
Original file line number Diff line number Diff line change 11{% - import "generator_macros.j2" as macros with context -%}
2- {{ macros.header() }}
3-
4- class {{ exercise | camel_case }}Test(unittest.TestCase):
5- {# All test cases in this exercise are nested, so use two for loops -#}
6- {% for case in cases -%}
2+ {% macro test_case (case ) -%}
3+ {% - set input = case ["input" ] -%}
74 def test_{{ case["description"] | to_snake }}(self):
85 self.assertIs(
96 {{ case["property"] | to_snake }}("{{ case["input"] ["sentence"] .replace('"', '\\"') }}"),
107 {{ case["expected"] }}
118 )
9+ {% - endmacro %}
10+ {{ macros.header()}}
11+
12+ class {{ exercise | camel_case }}Test(unittest.TestCase):
13+ {# All test cases in this exercise are nested, so use two for loops -#}
14+ {% for case in cases -%}
15+ {{ test_case(case) }}
1216 {% endfor %}
17+ {% if additional_cases | length -%}
1318
19+ # Additional tests for this track
20+
21+ {% for case in additional_cases -%}
22+ {{ test_case(case) }}
23+ {% endfor %}
24+ {% - endif %}
1425{{ macros.footer() }}
Original file line number Diff line number Diff line change @@ -41,6 +41,14 @@ def test_mixed_case_and_punctuation(self):
4141 def test_case_insensitive (self ):
4242 self .assertIs (is_pangram ("the quick brown fox jumps over with lazy FX" ), False )
4343
44+ # Additional tests for this track
45+
46+ def test_sentence_without_lower_bound (self ):
47+ self .assertIs (is_pangram ("bcdefghijklmnopqrstuvwxyz" ), False )
48+
49+ def test_sentence_without_upper_bound (self ):
50+ self .assertIs (is_pangram ("abcdefghijklmnopqrstuvwxy" ), False )
51+
4452
4553if __name__ == "__main__" :
4654 unittest .main ()
You can’t perform that action at this time.
0 commit comments