results["lower"] = xkcd_password.set_case(words, method="lower")
results["upper"] = xkcd_password.set_case(words, method="upper")
results["first"] = xkcd_password.set_case(words, method="first")
+ results["capitalize"] = xkcd_password.set_case(words, method="capitalize")
results["alternating"] = xkcd_password.set_case(words, method="alternating")
results["random"] = xkcd_password.set_case(words, method="random", testing=True)
self.assertTrue(all(word.islower() for word in results["lower"]))
self.assertTrue(all(word.isupper() for word in results["upper"]))
self.assertTrue(all(word.istitle() for word in results["first"]))
+ self.assertTrue(all(word.istitle() for word in results["capitalize"]))
# Test that the words have been correctly uppered randomly.
expected_random_result_1_py3 = ['THIS', 'IS', 'ONLY', 'a', 'GREAT', 'test']
expected_random_result_2_py3 = ['THIS', 'IS', 'a', 'test', 'ALSO', 'GREAT']
"""
return [w.upper() for w in words]
-def first_upper_case(words):
- """
- Set First character of each word to UPPER case.
- """
- return [w.capitalize() for w in words]
-
def lower_case(words):
"""
Set ALL words to LOWER case.
"""
return [w.lower() for w in words]
+def first_upper_case(words):
+ """
+ Set First character of each word to UPPER case.
+ """
+ return capitalize_case(words)
+
def capitalize_case(words):
"""
Set first letter of each words to UPPER case aka Capitalize.