Question: Pytest: def test_simpleDecode_1 (): assert simpleDecode('~,,Qf~,,Qf~RRQ', createAlphabet(),createCipher(createAlphabet())) == 'beep beep boop' def test_simpleDecode_2 (): assert simpleDecode('tbamret s==sida', createCipher('abtes= rmid'), createCipher(createCipher('abtes= rmid'))) == 'midterms == bad'
Pytest:
def test_simpleDecode_1(): assert simpleDecode('~,,Qf~,,Qf~RRQ', createAlphabet(),createCipher(createAlphabet())) == 'beep beep boop' def test_simpleDecode_2(): assert simpleDecode('tbamret s==sida', createCipher('abtes= rmid'), createCipher(createCipher('abtes= rmid'))) == 'midterms == bad' def test_simpleDecode_3(): assert simpleDecode('pasdnfghjhnkglzlkfhzjnglxhnfpnchnvanlsbglchf','onlythescarvbip ', 'pasdfghjklzxcvbn') == 'only these characters have to be in alphabet' def test_simpleDecode_4(): assert simpleDecode('abc','abg','ghj') == None def test_simpleDecode_5(): assert simpleDecode('abc','abg','ghzj') == -1 def simpleDecode(ciphertext, alphabet, cipher): """ Given ciphertext to decode, an alphabet and a cipher alphabet, return the decoded plaintext. If the lengths of the alphabet and cipher are not the same, return -1. If a character from ciphertext is not found in the cipher alphabet, return None. """ return "stub"
Note:
In the directions for the simpleDecode() function, it was stated that your function should return None if a ciphertext character does not exist in the alphabet. What we meant to say was that if a ciphertext character does not exist in your cipher alphabet, then return None. The reasoning for this is that if you cannot find a ciphertext character in your cipher, then there is no way to decode the ciphertext. This might be why some of you were facing difficulty with passing test_simpleDecode_3(). We will be testing your code with different alphabets and ciphers.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
