@@ -24,6 +24,14 @@ def encrypt(plaintext: str, key: str) -> str:
24
24
Traceback (most recent call last):
25
25
...
26
26
ValueError: plaintext is empty
27
+ >>> encrypt("coffee is good as python", "")
28
+ Traceback (most recent call last):
29
+ ...
30
+ ValueError: key is empty
31
+ >>> encrypt(527.26, "TheAlgorithms")
32
+ Traceback (most recent call last):
33
+ ...
34
+ TypeError: plaintext must be a string
27
35
"""
28
36
if not isinstance (plaintext , str ):
29
37
raise TypeError ("plaintext must be a string" )
@@ -80,6 +88,14 @@ def decrypt(ciphertext: str, key: str) -> str:
80
88
Traceback (most recent call last):
81
89
...
82
90
TypeError: ciphertext must be a string
91
+ >>> decrypt("", "TheAlgorithms")
92
+ Traceback (most recent call last):
93
+ ...
94
+ ValueError: ciphertext is empty
95
+ >>> decrypt("vvjfpk wj ohvp su ddylsv", 2)
96
+ Traceback (most recent call last):
97
+ ...
98
+ TypeError: key must be a string
83
99
"""
84
100
if not isinstance (ciphertext , str ):
85
101
raise TypeError ("ciphertext must be a string" )
0 commit comments