22from transpose import transpose
33
44
5- # Tests adapted from `problem-specifications//canonical-data.json` @ v1.0 .0
5+ # Tests adapted from `problem-specifications//canonical-data.json` @ v1.1 .0
66
77class TransposeTests (unittest .TestCase ):
88 def test_empty_string (self ):
@@ -14,15 +14,25 @@ def test_empty_string(self):
1414 )
1515
1616 def test_two_characters_in_a_row (self ):
17+ input_line = "A1"
18+ expected = [
19+ "A" ,
20+ "1"
21+ ]
1722 self .assertEqual (
18- transpose ("A1" ),
19- "\n " .join ([ "A" , "1" ] )
23+ transpose (input_line ),
24+ "\n " .join (expected )
2025 )
2126
2227 def test_two_characters_in_a_column (self ):
28+ input_line = [
29+ "A" ,
30+ "1"
31+ ]
32+ expected = "A1"
2333 self .assertEqual (
24- transpose ("\n " .join ([ "A" , "1" ] )),
25- "A1"
34+ transpose ("\n " .join (input_line )),
35+ expected
2636 )
2737
2838 def test_simple (self ):
@@ -35,7 +45,6 @@ def test_simple(self):
3545 "B2" ,
3646 "C3"
3747 ]
38-
3948 self .assertEqual (
4049 transpose ("\n " .join (input_line )),
4150 "\n " .join (expected )
@@ -182,77 +191,31 @@ def test_triangle(self):
182191 "\n " .join (expected )
183192 )
184193
185- def test_many_lines (self ):
194+ def test_mixed_line_length (self ):
186195 input_line = [
187- "Chor. Two households, both alike in dignity," ,
188- "In fair Verona, where we lay our scene," ,
189- "From ancient grudge break to new mutiny," ,
190- "Where civil blood makes civil hands unclean." ,
191- "From forth the fatal loins of these two foes" ,
192- "A pair of star-cross'd lovers take their life;" ,
193- "Whose misadventur'd piteous overthrows" ,
194- "Doth with their death bury their parents' strife." ,
195- "The fearful passage of their death-mark'd love," ,
196- "And the continuance of their parents' rage," ,
197- "Which, but their children's end, naught could remove," ,
198- "Is now the two hours' traffic of our stage;" ,
199- "The which if you with patient ears attend," ,
200- "What here shall miss, our toil shall strive to mend."
196+ "The longest line." ,
197+ "A long line." ,
198+ "A longer line." ,
199+ "A line."
201200 ]
202201 expected = [
203- "CIFWFAWDTAWITW" ,
204- "hnrhr hohnhshh" ,
205- "o oeopotedi ea" ,
206- "rfmrmash cn t" ,
207- ".a e ie fthow " ,
208- " ia fr weh,whh" ,
209- "Trnco miae ie" ,
210- "w ciroitr btcr" ,
211- "oVivtfshfcuhhe" ,
212- " eeih a uote " ,
213- "hrnl sdtln is" ,
214- "oot ttvh tttfh" ,
215- "un bhaeepihw a" ,
216- "saglernianeoyl" ,
217- "e,ro -trsui ol" ,
218- "h uofcu sarhu " ,
219- "owddarrdan o m" ,
220- "lhg to'egccuwi" ,
221- "deemasdaeehris" ,
222- "sr als t ists" ,
223- ",ebk 'phool'h," ,
224- " reldi ffd " ,
225- "bweso tb rtpo" ,
226- "oea ileutterau" ,
227- "t kcnoorhhnatr" ,
228- "hl isvuyee'fi " ,
229- " atv es iisfet" ,
230- "ayoior trr ino" ,
231- "l lfsoh ecti" ,
232- "ion vedpn l" ,
233- "kuehtteieadoe " ,
234- "erwaharrar,fas" ,
235- " nekt te rh" ,
236- "ismdsehphnnosa" ,
237- "ncuse ra-tau l" ,
238- " et tormsural" ,
239- "dniuthwea'g t " ,
240- "iennwesnr hsts" ,
241- "g,ycoi tkrttet" ,
242- "n ,l r s'a anr" ,
243- "i ef 'dgcgdi" ,
244- "t aol eoe,v" ,
245- "y nei sl,u; e" ,
246- ", .sf to l " ,
247- " e rv d t" ,
248- " ; ie o" ,
249- " f, r " ,
250- " e e m" ,
251- " . m e" ,
252- " o n" ,
253- " v d" ,
254- " e ." ,
255- " ,"
202+ "TAAA" ,
203+ "h " ,
204+ "elll" ,
205+ " ooi" ,
206+ "lnnn" ,
207+ "ogge" ,
208+ "n e." ,
209+ "glr" ,
210+ "ei " ,
211+ "snl" ,
212+ "tei" ,
213+ " .n" ,
214+ "l e" ,
215+ "i ." ,
216+ "n" ,
217+ "e" ,
218+ "."
256219 ]
257220 self .assertEqual (
258221 transpose ("\n " .join (input_line )),
0 commit comments