def main(): """ calls the test functions and will print whether or not the functions in the Network class work depending if the test functions return True or False """ #create a network object socialN = Network() #creates a user person object userM = Person() userM.set_name("Marilyn") userM.set_age(18) #creates a friend Person object and sets their name and age friendV = Person() friendV.set_name("Vanessa") friendV.set_age(18) #call test_add_friend() passing the friend as parameters #if the method returns True then the add_friend() function works if (TestNetwork.test_add_friend(socialN, friendV) == True): print("add_friend() function works") else: print("add_friend() function doesn't work") #creates another friend object and adds her to the set friendA = Person() friendA.set_name("Andrea") friendA.set_age(15) Network.add_friend(socialN, friendA) #call the test_get_friend() passing socialN as parameters #if the method returns True then the get_friend() function works if (TestNetwork.test_get_friends(socialN) == True): print("get_friends() function works") else: print("get_friends() function doesn't work") #call the test_get_friends_same_age() passing socialN as parameters #if the method returns True then the get_friend_same_age() function works if (TestNetwork.test_get_friends_same_age(socialN, userM) == True): print("get_friends_same_age() function works") else: print("get_friends_same_age() function doesn't work") #call the test_friend_to_remove() function #if the function returns True then the friend_to_remove() function works if (TestNetwork.test_friend_to_remove(socialN) == True): print("friend_to_remove() function works") else: print("friend_to_remove() function doesn't work") #call test_remove_friend() passing the friend as parameters #if the method returns True then the remove_friend() function works if (TestNetwork.test_remove_friend(socialN, friendV) == True): print("remove_friend() function works") else: print("remove_friend() function doesn't work") #call test_remove_all_friends() #if the method returns True then the remove_all_friends() function works if (TestNetwork.test_remove_all_friends(socialN) == True): print("remove_all_friends() function works") else: print("remove_all_friends() function doesn't work")
''' Created on Jun 4, 2013 module prints the doc string for the Network, Perosn, TestNetwork and TestPerson classes @author: Vanessa ''' from networkmodule import Network from personmodule import Person from testnetworkfixed import TestNetworkFixed from testperson import TestPerson from pydoc import help help(Network()) print() print() help(Person()) print() print() help(TestNetworkFixed()) print() print() help(TestPerson())
def setUp(self): socialN = Network()