generated from mwc/lab_weather
	friend_functions.py
This commit is contained in:
		@@ -10,16 +10,17 @@
 | 
			
		||||
# each and instead write code which returns the expected values. 
 | 
			
		||||
 | 
			
		||||
def count_people(people):
 | 
			
		||||
    """Counts the number of people. 
 | 
			
		||||
    
 | 
			
		||||
        >>> count_people(family)
 | 
			
		||||
        5
 | 
			
		||||
        >>> count_people(friends)
 | 
			
		||||
        10
 | 
			
		||||
    """
 | 
			
		||||
    raise NotImplementedError()
 | 
			
		||||
    >>> count_people(family)
 | 
			
		||||
    5
 | 
			
		||||
    >>> count_people(friends)
 | 
			
		||||
    10
 | 
			
		||||
    """
 | 
			
		||||
    return len(people)
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
def get_email(people, name):
 | 
			
		||||
    
 | 
			
		||||
#def get_email(people, name):
 | 
			
		||||
    """Returns the named person's email address. If there is no such person, returns None.
 | 
			
		||||
 | 
			
		||||
        >>> get_email(family, "Tad Winters")
 | 
			
		||||
@@ -27,9 +28,9 @@ def get_email(people, name):
 | 
			
		||||
        >>> get_email(friends, "Tad Winters")
 | 
			
		||||
        None
 | 
			
		||||
    """
 | 
			
		||||
    raise NotImplementedError()
 | 
			
		||||
#   raise NotImplementedError()
 | 
			
		||||
 | 
			
		||||
def count_favorite_colors(people, name):
 | 
			
		||||
#def count_favorite_colors(people, name):
 | 
			
		||||
    """Returns the number of colors liked by the named person. If there is no such person, returns None.
 | 
			
		||||
 | 
			
		||||
        >>> count_favorite_colors(family, "Tad Winters")
 | 
			
		||||
@@ -37,9 +38,9 @@ def count_favorite_colors(people, name):
 | 
			
		||||
        >>> count_favorite_colors(family, "Raphael Chambers")
 | 
			
		||||
        1
 | 
			
		||||
    """
 | 
			
		||||
    raise NotImplementedError()
 | 
			
		||||
#   raise NotImplementedError()
 | 
			
		||||
 | 
			
		||||
def people_who_like_color(people, color):
 | 
			
		||||
#def people_who_like_color(people, color):
 | 
			
		||||
    """Returns a list containing only those people who like the given color.
 | 
			
		||||
        >>> people_who_like_color(family, "yellow")
 | 
			
		||||
        [
 | 
			
		||||
@@ -57,9 +58,9 @@ def people_who_like_color(people, color):
 | 
			
		||||
        >>> people_who_like_color(family, "indigo")
 | 
			
		||||
        []
 | 
			
		||||
    """
 | 
			
		||||
    raise NotImplementedError()
 | 
			
		||||
#   raise NotImplementedError()
 | 
			
		||||
 | 
			
		||||
def count_people_who_like_color(people, color):
 | 
			
		||||
#def count_people_who_like_color(people, color):
 | 
			
		||||
    """Returns the number of people who like a given color. 
 | 
			
		||||
    
 | 
			
		||||
        >>> count_people_who_like_color(family, "red")
 | 
			
		||||
@@ -67,9 +68,9 @@ def count_people_who_like_color(people, color):
 | 
			
		||||
        >>> count_people_who_like_color(family, "orange")
 | 
			
		||||
        1
 | 
			
		||||
    """
 | 
			
		||||
    raise NotImplementedError()
 | 
			
		||||
#    raise NotImplementedError()
 | 
			
		||||
 | 
			
		||||
def get_color_dict(people):
 | 
			
		||||
#def get_color_dict(people):
 | 
			
		||||
    """Returns a dict showing how many people like each color. 
 | 
			
		||||
    Any color liked by any of the people will be included, and only colors
 | 
			
		||||
    liked by someone will be included. The order of items in the dict doesn't matter.
 | 
			
		||||
@@ -86,9 +87,4 @@ def get_color_dict(people):
 | 
			
		||||
            "orange": 1,
 | 
			
		||||
        }
 | 
			
		||||
    """
 | 
			
		||||
    raise NotImplementedError()
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#   raise NotImplementedError()
 | 
			
		||||
 
 | 
			
		||||
@@ -10,11 +10,11 @@ from unittest import TestCase, main
 | 
			
		||||
from people import friends, family
 | 
			
		||||
from friend_functions import (
 | 
			
		||||
    count_people, 
 | 
			
		||||
    get_email, 
 | 
			
		||||
    count_favorite_colors, 
 | 
			
		||||
    people_who_like_color, 
 | 
			
		||||
    count_people_who_like_color,
 | 
			
		||||
    get_color_dict,
 | 
			
		||||
   # get_email, 
 | 
			
		||||
   # count_favorite_colors, 
 | 
			
		||||
   # people_who_like_color, 
 | 
			
		||||
   # count_people_who_like_color,
 | 
			
		||||
   # get_color_dict,
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
class TestCountPeople(TestCase):
 | 
			
		||||
@@ -22,7 +22,7 @@ class TestCountPeople(TestCase):
 | 
			
		||||
        self.assertEqual(count_people(family), 5)
 | 
			
		||||
        self.assertEqual(count_people(friends), 10)
 | 
			
		||||
 | 
			
		||||
class TestGetEmail(TestCase):
 | 
			
		||||
"""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")
 | 
			
		||||
@@ -86,5 +86,5 @@ class TestGetColorDict(TestCase):
 | 
			
		||||
        }
 | 
			
		||||
        self.assertEqual(get_color_dict(family), familyExpected)
 | 
			
		||||
        self.assertEqual(get_color_dict(friends), friendsExpected)
 | 
			
		||||
 | 
			
		||||
"""
 | 
			
		||||
main()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user