File tree Expand file tree Collapse file tree 3 files changed +15
-2
lines changed
String multiplication/tests Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -20,4 +20,5 @@ def test_statement_1(self):
2020 with open ("concatenation.py" , "r" ) as taskfile :
2121 lines = taskfile .readlines ()
2222 code = lines [- 2 ]
23- self .assertTrue ("+" in code , msg = "Your solution does not use concatenation." )
23+ if not ("+" in code ):
24+ self .fail (msg = "Your solution does not use string concatenation." )
Original file line number Diff line number Diff line change @@ -10,5 +10,16 @@ def test_indexing(self):
1010 except ImportError :
1111 self .assertTrue (False , msg = "Do not rename any variables." )
1212
13+ def test_0_code_len (self ):
14+ with open ("string_indexing.py" , "r" ) as taskfile :
15+ lines = taskfile .readlines ()
16+ self .assertTrue (len (lines ) == 5 , msg = "Please do not add or remove any lines from the code file." )
17+
18+ def test_statement_1 (self ):
19+ with open ("string_indexing.py" , "r" ) as taskfile :
20+ lines = taskfile .readlines ()
21+ code = lines [- 2 ]
22+ if not ("[0]" in code ):
23+ self .fail (msg = "Your solution does not use string indexing." )
1324
1425
Original file line number Diff line number Diff line change @@ -19,4 +19,5 @@ def test_statement_1(self):
1919 with open ("string_multiplication.py" , "r" ) as taskfile :
2020 lines = taskfile .readlines ()
2121 code = lines [- 2 ]
22- self .assertTrue ("*" in code , msg = "Your solution does not use string multiplication." )
22+ if not ("*" in code ):
23+ self .fail (msg = "Your solution does not use string multiplication." )
You can’t perform that action at this time.
0 commit comments