generated from mwc/lab_weather
Uncommanded all tes_friend_functions to make sure all functions work!! No errors arose. I rememeber this from computer science 1. I feel the last function was the most challenging as you needed to created a dic. rather than a list set the {} before to create a dic. I used to += 1 within my function as to help tally the the count of fav. color from a person. That I remember from a previous computer science class as I do not think we have really learned super well here but it is helpful and useful.
This commit is contained in:
@@ -17,43 +17,43 @@ from friend_functions import (
|
||||
get_color_dict,
|
||||
)
|
||||
|
||||
# class TestCountPeople(TestCase):
|
||||
# def test_returns_correct_value(self):
|
||||
# self.assertEqual(count_people(family), 5)
|
||||
# self.assertEqual(count_people(friends), 10)
|
||||
class TestCountPeople(TestCase):
|
||||
def test_returns_correct_value(self):
|
||||
self.assertEqual(count_people(family), 5)
|
||||
self.assertEqual(count_people(friends), 10)
|
||||
|
||||
# class TestGetEmail(TestCase):
|
||||
# def test_returns_email_when_person_found(self):
|
||||
# self.assertEqual(get_email(family, "Perry Calderon"), "mus.donec@outlook.org")
|
||||
# self.assertEqual(get_email(friends, "Joy Tate"), "risus.a.ultricies@hotmail.org")
|
||||
class TestGetEmail(TestCase):
|
||||
def test_returns_email_when_person_found(self):
|
||||
self.assertEqual(get_email(family, "Perry Calderon"), "mus.donec@outlook.org")
|
||||
self.assertEqual(get_email(friends, "Joy Tate"), "risus.a.ultricies@hotmail.org")
|
||||
|
||||
# def test_returns_none_when_person_missing(self):
|
||||
# self.assertEqual(get_email(family, "Ken Kesey"), None)
|
||||
def test_returns_none_when_person_missing(self):
|
||||
self.assertEqual(get_email(family, "Ken Kesey"), None)
|
||||
|
||||
# class TestCountFavoriteColors(TestCase):
|
||||
# def test_returns_len_favorite_colors_when_person_found(self):
|
||||
# self.assertEqual(count_favorite_colors(family, "Tad Winters"), 2)
|
||||
# self.assertEqual(count_favorite_colors(friends,"Connor Rodriguez"), 4)
|
||||
# self.assertEqual(count_favorite_colors(friends, "Yuli Reynolds"), 0)
|
||||
class TestCountFavoriteColors(TestCase):
|
||||
def test_returns_len_favorite_colors_when_person_found(self):
|
||||
self.assertEqual(count_favorite_colors(family, "Tad Winters"), 2)
|
||||
self.assertEqual(count_favorite_colors(friends,"Connor Rodriguez"), 4)
|
||||
self.assertEqual(count_favorite_colors(friends, "Yuli Reynolds"), 0)
|
||||
|
||||
# def test_returns_none_when_person_missing(self):
|
||||
# self.assertEqual(count_favorite_colors(family, "Ken Kesey"), None)
|
||||
def test_returns_none_when_person_missing(self):
|
||||
self.assertEqual(count_favorite_colors(family, "Ken Kesey"), None)
|
||||
|
||||
# class TestPeopleWhoLikeColor(TestCase):
|
||||
# def test_returns_correct_length(self):
|
||||
# self.assertEqual(len(people_who_like_color(family, "blue")), 2)
|
||||
# self.assertEqual(len(people_who_like_color(family, "purple")), 0)
|
||||
class TestPeopleWhoLikeColor(TestCase):
|
||||
def test_returns_correct_length(self):
|
||||
self.assertEqual(len(people_who_like_color(family, "blue")), 2)
|
||||
self.assertEqual(len(people_who_like_color(family, "purple")), 0)
|
||||
|
||||
# def test_returns_full_dicts(self):
|
||||
# result = people_who_like_color(family, "orange")
|
||||
# self.assertEqual(len(result), 1)
|
||||
# self.assertEqual(result[0]["email"], "auctor.odio@icloud.ca")
|
||||
def test_returns_full_dicts(self):
|
||||
result = people_who_like_color(family, "orange")
|
||||
self.assertEqual(len(result), 1)
|
||||
self.assertEqual(result[0]["email"], "auctor.odio@icloud.ca")
|
||||
|
||||
# class TestCountPeopleWhoLikeColor(TestCase):
|
||||
# def test_returns_correct_count(self):
|
||||
# self.assertEqual(count_people_who_like_color(friends, "grey"), 2)
|
||||
# self.assertEqual(count_people_who_like_color(friends, "beige"), 1)
|
||||
# self.assertEqual(count_people_who_like_color(friends, "cornflower"), 0)
|
||||
class TestCountPeopleWhoLikeColor(TestCase):
|
||||
def test_returns_correct_count(self):
|
||||
self.assertEqual(count_people_who_like_color(friends, "grey"), 2)
|
||||
self.assertEqual(count_people_who_like_color(friends, "beige"), 1)
|
||||
self.assertEqual(count_people_who_like_color(friends, "cornflower"), 0)
|
||||
|
||||
class TestGetColorDict(TestCase):
|
||||
def test_returns_correct_dict(self):
|
||||
@@ -87,4 +87,4 @@ class TestGetColorDict(TestCase):
|
||||
self.assertEqual(get_color_dict(family), familyExpected)
|
||||
self.assertEqual(get_color_dict(friends), friendsExpected)
|
||||
|
||||
# main()
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user