def test_left_join_empty_right(left_map): empty_map = {} assert left_join(left_map, empty_map) == [['fond', 'enamored', None], ['wrath', 'anger', None], ['diligent', 'employed', None], ['outfit', 'garb', None], ['guide', 'usher', None]]
def test_no_matches(hash): actual = left_join(hash[2], hash[3]) expected = [ ["rich", "wealthy", None], ["good", "nice", None], ["long", "tall", None], ["happy", "amused", None], ] assert actual == expected
def test_join_left_all_the_same(hash): actual = left_join(hash[0], hash[1]) expected = [ ["fond", "enamored", "averse"], ["wrath", "anger", "delight"], ["diligent", "employer", "idle"], ["outfit", "garb", None], ["guide", "usher", "follow"], ] assert actual == expected
def test_one_is_empty(hash): actual = left_join(hash[4], hash[5]) expected = [ ["fond", "enamored", None], ["wrath", "anger", None], ["diligent", "employer", None], ["outfit", "garb", None], ["guide", "usher", None], ] assert actual == expected
def test_empty_first_ht(): ht1 = Hashtable() ht2 = Hashtable() ht2.add("fond", "averse") ht2.add("wrath", "delight") ht2.add("diligent", "idle") ht2.add("guide", "follow") ht2.add("flow", "jam") actual = left_join(ht1, ht2) # changed order from example. order is dependent on hash function. intent met. expected = [] assert actual == expected
def test_empty_second_ht(): ht1 = Hashtable() ht1.add("fond", "enamored") ht1.add("wrath", "anger") ht1.add("diligent", "employed") ht1.add("outfit", "garb") ht1.add("guide", "usher") ht2 = Hashtable() actual = left_join(ht1, ht2) # changed order from example. order is dependent on hash function. intent met. expected = [ ["fond", "enamored", None], ["diligent", "employed", None], ["guide", "usher", None], ["outfit", "garb", None], ["wrath", "anger", None], ] assert actual == expected
def test_provided_example(): ht1 = Hashtable() ht1.add("fond", "enamored") ht1.add("wrath", "anger") ht1.add("diligent", "employed") ht1.add("outfit", "garb") ht1.add("guide", "usher") ht2 = Hashtable() ht2.add("fond", "averse") ht2.add("wrath", "delight") ht2.add("diligent", "idle") ht2.add("guide", "follow") ht2.add("flow", "jam") actual = left_join(ht1, ht2) # changed order from example. order is dependent on hash function. intent met. expected = [ ["fond", "enamored", "averse"], ["diligent", "employed", "idle"], ["guide", "usher", "follow"], ["outfit", "garb", None], ["wrath", "anger", "delight"], ] assert actual == expected
def test_left_join(test_hash_one, test_hash_two): actual = left_join(test_hash_one, test_hash_two) expected = [['fond', 'enamored', 'averse'], ['wrath', 'anger', 'delight'], ['guide', 'usher', 'follow'], ['outfit', 'garb', None], ['diligent', 'employed', 'idle']] assert actual == expected
def test_left_join_happy_path(left_map, right_map): assert left_join(left_map, right_map) == [['fond', 'enamored', 'averse'], ['wrath', 'anger', 'delight'], ['diligent', 'employed', 'idle'], ['outfit', 'garb', None], ['guide', 'usher', 'follow']]
def test_left_join_both_empty(): empty_map = {} assert left_join(empty_map, empty_map) == []
def test_left_join_empty_left(right_map): empty_map = {} assert left_join(empty_map, right_map) == []