File tree 3 files changed +15
-2
lines changed
String multiplication/tests
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):
20
20
with open ("concatenation.py" , "r" ) as taskfile :
21
21
lines = taskfile .readlines ()
22
22
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):
10
10
except ImportError :
11
11
self .assertTrue (False , msg = "Do not rename any variables." )
12
12
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." )
13
24
14
25
Original file line number Diff line number Diff line change @@ -19,4 +19,5 @@ def test_statement_1(self):
19
19
with open ("string_multiplication.py" , "r" ) as taskfile :
20
20
lines = taskfile .readlines ()
21
21
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