def test_chars_counter_only_lowercase(self): try: expected_result = { 'l': 3, 'o': 2, '!': 1, ' ': 1, 'e': 1, 'd': 1, 'h': 1, 'r': 1, 'w': 1 } result = exercises.chars_counter("hello world!") self.assertDictEqual(expected_result, result) except ForbiddenError as err: print("You CANNOT use `collections.Counter` built-in method.") raise err
def test_chars_counter_lowercase_and_uppercase(self): try: expected_result = { 'a': 9, ' ': 6, 'n': 4, ',': 3, 'm': 2, 'l': 2, 'A': 1, 'c': 1, 'P': 1, 'p': 1, '!': 1 } result = exercises.chars_counter("A man, a plan, a canal, Panama!") self.assertDictEqual(expected_result, result) except ForbiddenError as err: print("You CANNOT use `collections.Counter` built-in method.") raise err