def test_01_more_persons_one_friend_same_last(self): param = {'Clare Dunphy': ['Elon Dunphy'], \ 'Bill Gates': ['Hugh Gates'], \ 'Jeff Bezos': ['Jared Bezos']} actual = club_functions.get_last_to_first(param) expected = {'Dunphy': ['Clare', 'Elon'], \ 'Gates': ['Bill', 'Hugh'], 'Bezos': ['Jared', 'Jeff']} msg = "Expected {}, but returned {}".format(expected, actual) self.assertEqual(actual, expected, msg)
def test_00_empty(self): """ Test get_last_to_first with an empty dictionary. """ param = {} actual = club_functions.get_last_to_first(param) expected = {} msg = "Expected {}, but returned {}".format(expected, actual) self.assertEqual(actual, expected, msg)
def test_07_multi_people_one_friend_same_last(self): param = { 'Clare Dunphy': ['Phil Dunphy'], 'Jay Pritchette': ['Joe Pritchette'] } actual = club_functions.get_last_to_first(param) expected = {'Dunphy': ['Clare', 'Phil'], 'Pritchette': ['Jay', 'Joe']} msg = "Expected {}, but returned {}".format(expected, actual) self.assertEqual(actual, expected, msg)
def test_02_one_person_many_friends_same_last(self): param = { 'Claire Dunphy': ['Jennifer Dunphy', 'Sophia Dunphy', 'Gab Dunphy'] } actual = club_functions.get_last_to_first(param) expected = {'Dunphy': ['Claire', 'Gab', 'Jennifer', 'Sophia']} msg = "Expected {}, but returned {}".format(expected, actual) self.assertEqual(actual, expected, msg)
def test_08_multi_people_different_friends_same_last(self): param = { 'Clare Dunphy': ['Phil Dunphy'], 'Alex Dunphy': ['Luke Dunphy', 'Hailey Dunphy'] } actual = club_functions.get_last_to_first(param) expected = {'Dunphy': ['Alex', 'Clare', 'Hailey', 'Luke', 'Phil']} msg = "Expected {}, but returned {}".format(expected, actual) self.assertEqual(actual, expected, msg)
def test_04_mutual_friends(self): param = { 'Rebecca Donaldson-Katsopolis': ['Kimmy Gibbler'], 'Kimmy Gibbler': ['Rebecca Donaldson-Katsopolis'] } actual = club_functions.get_last_to_first(param) expected = {'Donaldson-Katsopolis': ['Rebecca'], 'Gibbler': ['Kimmy']} msg = "Expected {}, but returned {}".format(expected, actual) self.assertEqual(actual, expected, msg)
def test_01_more_persons_one_friend_different_last(self): param = {'Clare Dunphy': ['Elon Musk'],\ 'Bill Gates': ['Hugh Jackman'], \ 'Jeff Bezos': ['Jared Leto']} actual = club_functions.get_last_to_first(param) expected = {'Dunphy': ['Clare'], 'Gates': ['Bill'], 'Bezos': ['Jeff'], \ 'Jackman': ['Hugh'], 'Musk': ['Elon'], 'Leto': ['Jared']} msg = "Expected {}, but returned {}".format(expected, actual) self.assertEqual(actual, expected, msg)
def test_02_one_person_one_friend_different_last(self): """ Test get_last_to_first with a single key single value (different last name) dictionary. """ param = {'Clare Dunphy': ['Jay Pritchett']} actual = club_functions.get_last_to_first(param) expected = {'Dunphy': ['Clare'], 'Pritchett': ['Jay']} msg = "Expected {}, but returned {}".format(expected, actual) self.assertEqual(actual, expected, msg)
def test_01_one_person_one_friend_same_last(self): """ Test get_last_to_first with a single key single value (same last name) dictionary. """ param = {'Clare Dunphy': ['Phil Dunphy']} actual = club_functions.get_last_to_first(param) expected = {'Dunphy': ['Clare', 'Phil']} msg = "Expected {}, but returned {}".format(expected, actual) self.assertEqual(actual, expected, msg)
def test_05_one_person_two_friends_diff_last(self): param = {'Danny R Tanner': ['Jesse Katsopolis', 'Joey Gladstone']} actual = club_functions.get_last_to_first(param) expected = { 'Gladstone': ['Joey'], 'Katsopolis': ['Jesse'], 'Tanner': ['Danny R'] } msg = "Expected {}, but returned {}".format(expected, actual) self.assertEqual(actual, expected, msg)
def test_04_one_person_different_friends_different_last(self): param = {'Clare Dunphy': ['Jay Pritchette', 'Manny Delgado']} actual = club_functions.get_last_to_first(param) expected = { 'Dunphy': ['Clare'], 'Pritchette': ['Jay'], 'Delgado': ['Manny'] } msg = "Expected {}, but returned {}".format(expected, actual) self.assertEqual(actual, expected, msg)
def test_06_two_persons_multiple_friends(self): param = {'Clare-Test Dunphy': ['John A Doe', 'John Smith', \ 'Alex Smith', 'John Dan-E'], \ 'Testing Test': ['John A Doe', 'Clare-Test Dunphy', \ 'Jane Doe', 'A Doe']} actual = club_functions.get_last_to_first(param) expected = {'Dunphy': ['Clare-Test'], 'Doe': ['A', 'Jane', 'John A'], \ 'Dan-E': ['John'], 'Smith': ['Alex', 'John'], \ 'Test': ['Testing']} msg = "Expected {}, but returned {}".format(expected, actual) self.assertEqual(actual, expected, msg)
def test02GetLastToFirst(self): """Function get_last_to_first.""" print('\nChecking get_last_to_first...') result = cf.get_last_to_first(self.p2f) error_msg = 'get_last_to_first should return a Dict[str, List[str]]' self._is_dict_of_Ks_and_list_Vs(result, str, str, error_msg) print(' check complete')
def test_04_many_people_many_friends_same_last(self): param = { 'Claire Dunphy': ['Sophia Dunphy', 'Hugo Dunphy', 'Merve Dunphy'], 'Gab Dunphy': ['Thomas Dunphy', 'Axel Dunphy'] } actual = club_functions.get_last_to_first(param) expected = { 'Dunphy': ['Axel', 'Claire', 'Gab', 'Hugo', 'Merve', 'Sophia', 'Thomas'] } msg = "Expected {}, but returned {}".format(expected, actual) self.assertEqual(actual, expected, msg)
def test_03_one_person_many_friends_different_last(self): param = { 'Claire Dunphy': ['Phil Vo', 'Sophia Huang', 'Merve Younessi'] } actual = club_functions.get_last_to_first(param) expected = { 'Dunphy': ['Claire'], 'Vo': ['Phil'], 'Huang': ['Sophia'], 'Younessi': ['Merve'] } msg = "Expected {}, but returned {}".format(expected, actual) self.assertEqual(actual, expected, msg)
def test_06_many_people_some_mutual_friends_different_last(self): param = { 'Claire Dunphy': ['Phil Dunphy', 'Sophia Huang', 'Merve Dunphy'], 'Claire Trottier': ['Dominique Walker', 'Sophia Huang'] } actual = club_functions.get_last_to_first(param) expected = { 'Dunphy': ['Claire', 'Merve', 'Phil'], 'Huang': ['Sophia'], 'Walker': ['Dominique'], 'Trottier': ['Claire'] } msg = "Expected {}, but returned {}".format(expected, actual) self.assertEqual(actual, expected, msg)
def test_12_multi_people_different_friends_some_same_last(self): param = { 'Clare Dunphy': ['Hailey Dunphy', 'Andy Bailey'], 'Jay Pritchette': ['Manny Delgado'], } actual = club_functions.get_last_to_first(param) expected = { 'Dunphy': ['Clare', 'Hailey'], 'Pritchette': ['Jay'], 'Delgado': ['Manny'], 'Bailey': ['Andy'] } msg = "Expected {}, but returned {}".format(expected, actual) self.assertEqual(actual, expected, msg)
def test_09_multi_people_one_friend_different_last(self): param = { 'Clare Dunphy': ['Cameron Tucker'], 'Jay Pritchette': ['Manny Delgado'] } actual = club_functions.get_last_to_first(param) expected = { 'Dunphy': ['Clare'], 'Pritchette': ['Jay'], 'Delgado': ['Manny'], 'Tucker': ['Cameron'] } msg = "Expected {}, but returned {}".format(expected, actual) self.assertEqual(actual, expected, msg)
def test_06_two_people_mix(self): param = { 'Luke Dunphy': ['Gloria Pritchett', 'Alex Dunphy'], 'Cameron Tucker': ['Gloria Pritchett', 'Manny Delgado'] } actual = club_functions.get_last_to_first(param) expected = { 'Delgado': ['Manny'], 'Dunphy': ['Alex', 'Luke'], 'Pritchett': ['Gloria'], 'Tucker': ['Cameron'] } msg = "Expected {}, but returned {}".format(expected, actual) self.assertEqual(actual, expected, msg)
def test_05_many_person_many_friend(self): param = {'Jesse Katsopolis': ['Danny R Tanner', 'Joey Gladstone', 'Rebecca Donaldson-Katsopolis'], 'Rebecca Donaldson-Katsopolis': ['Kimmy Gibbler'], 'Stephanie J Tanner': ['Michelle Tanner', 'Kimmy Gibbler'], 'Danny R Tanner': ['Jesse Katsopolis', 'DJ Tanner-Fuller', 'Joey Gladstone']} actual = club_functions.get_last_to_first(param) expected = {'Katsopolis': ['Jesse'], \ 'Tanner': ['Danny R', 'Michelle', 'Stephanie J'], \ 'Gladstone': ['Joey'], \ 'Donaldson-Katsopolis': ['Rebecca'], \ 'Gibbler': ['Kimmy'],'Tanner-Fuller': ['DJ']} msg = "Expected {}, but returned {}".format(expected, actual) self.assertEqual(actual, expected, msg)
def test_03_one_person_four_friends_same_last(self): """ Test get_last_to_first with a single key multiple value (all same last name) dictionary. """ param = { 'Clare Dunphy': ([ 'Phil Dunphy', 'Haley Gwendolyn Dunphy', 'Luke Dunphy', 'Alex Dunphy' ]) } actual = club_functions.get_last_to_first(param) expected = { 'Dunphy': (['Alex', 'Clare', 'Haley Gwendolyn', 'Luke', 'Phil']) } msg = "Expected {}, but returned {}".format(expected, actual) self.assertEqual(actual, expected, msg)
def test_06_four_people_one_friend_each_same_last(self): """ Test get_last_to_first with multiple key single value (same last name as its key) dictionary. """ param = { 'Clare Dunphy': ['Haley Gwendolyn Dunphy'], 'Haley Gwendolyn Dunphy': ['Alex Dunphy'], 'Jay Pritchett': ['Gloria Pritchett'], 'Manny Delgado': ['Javier Hectoro Delgado'] } actual = club_functions.get_last_to_first(param) expected = { 'Dunphy': ['Alex', 'Clare', 'Haley Gwendolyn'], 'Pritchett': ['Gloria', 'Jay'], 'Delgado': ['Javier Hectoro', 'Manny'] } msg = "Expected {}, but returned {}".format(expected, actual) self.assertEqual(actual, expected, msg)
def test_09_four_people_four_friends_each_same_last(self): """ Test get_last_to_first with multiple key multiple value (all same last name as their respective keys) dictionary. """ param = { 'a A': ['b A', 'c A', 'd A', 'e A'], 'b B': ['a B', 'c B', 'd B', 'e B'], 'z A': ['a A', 'y A', 't A', 'q A'], 'm M': ['e M', 'j M', 'o M', 't M'], } actual = club_functions.get_last_to_first(param) expected = { 'A': ['a', 'b', 'c', 'd', 'e', 'q', 't', 'y', 'z'], 'B': ['a', 'b', 'c', 'd', 'e'], 'M': ['e', 'j', 'm', 'o', 't'] } msg = "Expected {}, but returned {}".format(expected, actual) self.assertEqual(actual, expected, msg)
def test_04_one_person_four_friend_mixed(self): """ Test get_last_to_first with a single key multiple value (some with the same last name) dictionary. """ param = { 'Clare Dunphy': ([ 'Jay Pritchett', 'Manny Delgado', 'Luke Dunphy', 'Dylan D-money' ]) } actual = club_functions.get_last_to_first(param) expected = { 'Dunphy': ['Clare', 'Luke'], 'Pritchett': ['Jay'], 'Delgado': ['Manny'], 'D-money': ['Dylan'] } msg = "Expected {}, but returned {}".format(expected, actual) self.assertEqual(actual, expected, msg)
def test_05_one_person_four_friend_different_last(self): """ Test get_last_to_first with a single key multiple value (all with different last names) dictionary. """ param = { 'Clare Dunphy': ([ 'Jay Pritchett', 'Manny Delgado', 'Scrooge McDuck', 'Dylan D-money' ]) } actual = club_functions.get_last_to_first(param) expected = { 'Dunphy': ['Clare'], 'Pritchett': ['Jay'], 'Delgado': ['Manny'], 'McDuck': ['Scrooge'], 'D-money': ['Dylan'] } msg = "Expected {}, but returned {}".format(expected, actual) self.assertEqual(actual, expected, msg)
def test_08_four_people_one_friend_each_different_last(self): """ Test get_last_to_first with multiple key single value (all with different last name than its key) dictionary. """ param = { 'Clare Dunphy': ['Jay Pritchett'], 'Manny Delgado': ['Scrooge McDuck'], 'Haley Gwendolyn Dunphy': ['Dylan D-money'], 'Jay Pritchett': ['Manny Delgado'] } actual = club_functions.get_last_to_first(param) expected = { 'Dunphy': ['Clare', 'Haley Gwendolyn'], 'Pritchett': ['Jay'], 'Delgado': ['Manny'], 'McDuck': ['Scrooge'], 'D-money': ['Dylan'] } msg = "Expected {}, but returned {}".format(expected, actual) self.assertEqual(actual, expected, msg)
def test_03_one_person_no_friends(self): param = {'Clare Dunphy': []} actual = club_functions.get_last_to_first(param) expected = {'Dunphy': ['Clare']} msg = "Expected {}, but returned {}".format(expected, actual) self.assertEqual(actual, expected, msg)
def test_02_one_person_one_friend_diff_last(self): param = {'Clare Dunphy': ['Michelle Tanner']} actual = club_functions.get_last_to_first(param) expected = {'Dunphy': ['Clare'], 'Tanner': ['Michelle']} msg = "Expected {}, but returned {}".format(expected, actual) self.assertEqual(actual, expected, msg)
def test_05_one_person_different_friends_some_same_last(self): param = {'Clare Dunphy': ['Hailey Dunphy', 'Andy Bailey']} actual = club_functions.get_last_to_first(param) expected = {'Dunphy': ['Clare', 'Hailey'], 'Bailey': ['Andy']} msg = "Expected {}, but returned {}".format(expected, actual) self.assertEqual(actual, expected, msg)
def test_03_one_person_different_friends_same_last(self): param = {'Alex Dunphy': ['Luke Dunphy', 'Hailey Dunphy']} actual = club_functions.get_last_to_first(param) expected = {'Dunphy': ['Alex', 'Hailey', 'Luke']} msg = "Expected {}, but returned {}".format(expected, actual) self.assertEqual(actual, expected, msg)