-
Notifications
You must be signed in to change notification settings - Fork 5
/
test_dicts.py
19 lines (15 loc) · 1.01 KB
/
test_dicts.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import unittest
from dicts import *
class Tester(unittest.TestCase):
def test_alphabet_counter(self):
self.assertDictEqual(alphabet_counter("Hello"), {'H': 1, 'e': 1, 'l': 2, 'o': 1})
self.assertDictEqual(alphabet_counter("Oh My God"), {'O': 1, 'h': 1, ' ': 2, 'M': 1, 'y': 1, 'G': 1, 'o': 1, 'd': 1})
self.assertDictEqual(alphabet_counter("Wingardium Leviosa"), {'W': 1, 'i': 3, 'n': 1, 'g': 1, 'a': 2, 'r': 1, 'd': 1,
'u': 1, 'm': 1, ' ': 1, 'L': 1, 'e': 1, 'v': 1, 'o': 1, 's': 1})
print("\n.Passed task 1 with no errors!")
def test_alphabet_counter_version_two(self):
self.assertDictEqual(alphabet_counter_version_two("Hello"), {'h': 1, 'e': 1, 'l': 2, 'o': 1})
self.assertDictEqual(alphabet_counter_version_two("Oh My God"), {'o': 2, 'h': 1, 'm': 1, 'y': 1, 'g': 1, 'd': 1})
self.assertDictEqual(alphabet_counter_version_two("Wingardium Leviosa"), {'w': 1, 'i': 3, 'n': 1, 'g': 1, 'a': 2, 'r': 1, 'd': 1,
'u': 1, 'm': 1, 'l': 1, 'e': 1, 'v': 1, 'o': 1, 's': 1})
print("Passed task 2 with no errors!")