before writing this testi expected to write extend_keyword as standalone function that accepted keyword and an integer but as started drafting the testi realized it made more sense to use it as helper method on the vigenerecipher class this shows how test-driven development can help design more sensible apis here' the method implementationdef extend_keyword(selfnumber)repeats number /len(self keyword return (self keyword repeats)[:numberonce againthis took few runs of the test to get right ended up adding second versions of the testone with fifteen and one with sixteen lettersto make sure it works if the integer division has an even number now we're finally ready to write our encode methoddef encode(selfplaintext)cipher [keyword self extend_keyword(len(plaintext)for , in zip(plaintextkeyword)cipher append(combine_character( , )return "join(cipherthat looks correct our test suite should pass nowrightactuallyif we run itwe'll find that two tests are still failing we totally forgot about the spaces and lowercase charactersit is good thing we wrote those tests to remind us we'll have to add this line at the beginning of the methodplaintext plaintext replace("""upper(if we have an idea about corner case in the middle of implementing somethingwe can create test describing that idea we don' even have to implement the testwe can just run assert false to remind us to implement it later the failing test will never let us forget the corner case and it can' be ignored like filing task can if it takes while to get around to fixing the implementationwe can mark the test as an expected failure now all the tests pass successfully this is pretty longso we'll condense the examples for decoding here are couple testsdef test_separate_character()assert separate_character(" "" "="