@@ -21,13 +21,15 @@ def lower():
2121 assert "DDd12Vv" .lower () == "ddd12vv"
2222 assert "" .lower () == ""
2323
24+
2425def upper ():
2526 s : str
2627 s = "AaaaAABBbbbbBB!@12223BN"
2728 assert s .upper () == "AAAAAABBBBBBBB!@12223BN"
2829 assert "DDd12Vv" .upper () == "DDD12VV"
2930 assert "" .upper () == ""
3031
32+
3133def strip ():
3234 s : str
3335 s = " AASAsaSas "
@@ -88,14 +90,15 @@ def startswith():
8890 assert s .startswith ("sdd" ) == False
8991 assert "" .startswith ("ok" ) == False
9092
93+
9194def endswith ():
9295
9396 # The following test suite fulfils the control flow graph coverage
9497 # in terms of Statement Coverage and Branch Coverage associated with endwith() functionality.
9598
96- # Case 1: When string is constant and suffix is also constant
99+ # Case 1: When string is constant and suffix is also constant
97100 assert "" .endswith ("" ) == True
98- assert "" .endswith (" " ) == False
101+ assert "" .endswith (" " ) == False
99102 assert "" .endswith ("%" ) == False
100103 assert "" .endswith ("a1234PT#$" ) == False
101104 assert "" .endswith ("blah blah" ) == False
@@ -105,13 +108,12 @@ def endswith():
105108 assert " rendezvous 5:30 " .endswith ("apple" ) == False
106109 assert "two plus" .endswith ("longer than string" ) == False
107110
108-
109111 # Case 2: When string is constant and suffix is variable
110112 suffix : str
111113 suffix = ""
112114 assert "" .endswith (suffix ) == True
113115 suffix = " "
114- assert "" .endswith (suffix ) == False
116+ assert "" .endswith (suffix ) == False
115117 suffix = "5:30 "
116118 assert " rendezvous 5:30 " .endswith (suffix ) == True
117119 suffix = ""
@@ -138,13 +140,14 @@ def endswith():
138140 suffix = "apple"
139141 assert s .endswith (suffix ) == False
140142
143+
141144def partition ():
142-
143- # Note: Both string or seperator cannot be empty
144- # Case 1: When string is constant and seperator is also constant
145- assert " " .partition (" " ) == ("" ," " ," " )
146- assert "apple mango" .partition (" " ) == ("apple" ," " ,"mango" )
147- assert "applemango" .partition ("afdnjkfsn" ) == ("applemango" ,"" ,"" )
145+
146+ # Note: Both string or seperator cannot be empty
147+ # Case 1: When string is constant and seperator is also constant
148+ assert " " .partition (" " ) == ("" , " " , " " )
149+ assert "apple mango" .partition (" " ) == ("apple" , " " , "mango" )
150+ assert "applemango" .partition ("afdnjkfsn" ) == ("applemango" , "" , "" )
148151 assert "applemango" .partition ("an" ) == ("applem" , "an" , "go" )
149152 assert "applemango" .partition ("mango" ) == ("apple" , "mango" , "" )
150153 assert "applemango" .partition ("applemango" ) == ("" , "applemango" , "" )
@@ -154,15 +157,17 @@ def partition():
154157 # Case 2: When string is constant and seperator is variable
155158 seperator : str
156159 seperator = " "
157- assert " " .partition (seperator ) == ("" ," " ," " )
160+ assert " " .partition (seperator ) == ("" , " " , " " )
158161 seperator = " "
159- assert "apple mango" .partition (seperator ) == ("apple" ," " ,"mango" )
162+ assert "apple mango" .partition (seperator ) == ("apple" , " " , "mango" )
160163 seperator = "5:30 "
161- assert " rendezvous 5:30 " .partition (seperator ) == (" rendezvous " , "5:30 " , "" )
164+ assert " rendezvous 5:30 " .partition (
165+ seperator ) == (" rendezvous " , "5:30 " , "" )
162166 seperator = "^&"
163167 assert "@#$%^&*()#!" .partition (seperator ) == ("@#$%" , "^&" , "*()#!" )
164168 seperator = "daddada "
165- assert " rendezvous 5:30 " .partition (seperator ) == (" rendezvous 5:30 " , "" , "" )
169+ assert " rendezvous 5:30 " .partition (
170+ seperator ) == (" rendezvous 5:30 " , "" , "" )
166171 seperator = "longer than string"
167172 assert "two plus" .partition (seperator ) == ("two plus" , "" , "" )
168173
@@ -182,6 +187,7 @@ def partition():
182187 seperator = "apple"
183188 assert s .partition (seperator ) == ("rendezvous 5" , "" , "" )
184189
190+
185191def is_lower ():
186192 # Case 1: When constant string is present
187193 assert "" .islower () == False
@@ -204,8 +210,9 @@ def is_lower():
204210 s = "apple is a fruit"
205211 assert s .islower () == True
206212
213+
207214def is_upper ():
208- # Case 1: When constant string is present
215+ # Case 1: When constant string is present
209216 assert "" .isupper () == False
210217 assert "apple" .isupper () == False
211218 assert "4432632479" .isupper () == False
@@ -226,6 +233,7 @@ def is_upper():
226233 s = "APPLE IS A FRUIT"
227234 assert s .isupper () == True
228235
236+
229237def is_decimal ():
230238 # Case 1: When constant string is present
231239 assert "" .isdecimal () == False
@@ -251,6 +259,7 @@ def is_decimal():
251259 s = "12 34"
252260 assert s .isdecimal () == False
253261
262+
254263def is_ascii ():
255264 # Case 1: When constant string is present
256265 assert "" .isascii () == True
@@ -280,12 +289,16 @@ def is_ascii():
280289def is_space ():
281290 assert "\n " .isspace () == True
282291 assert " " .isspace () == True
283- assert "\r " .isspace () == True
292+ assert "\r " .isspace () == True
293+ assert "" .isspace () == False
284294
285- s :str = " "
286- assert s .isspace () == True
295+ s : str = " "
296+ assert s .isspace () == True
287297 s = "a"
288298 assert s .isspace () == False
299+ s = ""
300+ assert s .isspace () == False
301+
289302
290303def check ():
291304 capitalize ()
@@ -303,4 +316,5 @@ def check():
303316 is_ascii ()
304317 is_space ()
305318
319+
306320check ()
0 commit comments