Пример #1
0
    def test_giveBio(self): # From person.py
        self.assertEqual(p.giveBio(self.actorName, 1), '1964-09-02')   # test for birth date
        self.assertEqual(p.giveBio(self.actorName, 2), 'Beirut, Lebanon') # test for birth place
        with patch('builtins.print') as mock_print:
            p.giveBio(self.actorName, 3)

            mock_print.assert_called_once_with("IMDBot: The latest movie Keanu Reeves has worked in is Rain ()")   # test for the latest movie
Пример #2
0
        elif ('what' in user_input
              and ('other' in user_input or 'another' in user_input)):
            #takes in user input and calls otherRoles() from person.py
            if 'person' in locals():
                print("IMDBot: Hmm... let me think...")
                p.otherRoles(person)  # Takes person object
            else:
                print("IMDBot: Sorry I am not sure how to help with that.")

        elif (sy.findSyns(user_input, 'birthday') == 0 or
              ('when' in user_input and sy.findSyns(user_input, 'born') == 0)):
            #Call giveBio() from person.py
            #Search for birthday/birthdate
            print("IMDBot: Hmm... let me think...")
            if 'person' in locals():
                p.giveBio(person['name'], 1)
            elif person_name != '':
                p.giveBio(person_name, 1)
            else:
                print("IMDBot: I\'m not sure who you\'re asking about.")
            print("IMDBot: What else would you like to know?")

        elif (('where' in user_input or 'place' in user_input)
              and ('born' in user_input or 'birth' in user_input)):
            #Search for birth place of an actor
            print("IMDBot: Hmm... let me think...")
            if 'person' in locals():
                p.giveBio(person['name'], 2)
            elif person_name != '':
                p.giveBio(person_name, 2)
            else:
Пример #3
0
        elif ('what' in user_input
              and ('other' in user_input or 'another' in user_input)):
            #takes in user input and calls otherRoles() from person.py
            if 'person' in locals():
                print("IMDBot: Hmm... let me think...")
                p.otherRoles(person)  # Takes person object
            else:
                print("IMDBot: Sorry I am not sure how to help with that.")

        elif (sy.findSyns(user_input, 'birthday') == 0 or
              ('when' in user_input and sy.findSyns(user_input, 'born') == 0)):
            #Call giveBio() from person.py
            #Search for birthday/birthdate
            print("IMDBot: Hmm... let me think...")
            if 'person' in locals():
                p.giveBio(person['name'], 1, userName)
            elif person_name != '':
                p.giveBio(person_name, 1, userName)
            else:
                print("IMDBot: I\'m not sure who you\'re asking about.")
            print("IMDBot: What else would you like to know?")

        elif (('where' in user_input or 'place' in user_input)
              and ('born' in user_input or 'birth' in user_input)):
            #Search for birth place of an actor
            print("IMDBot: Hmm... let me think...")
            if 'person' in locals():
                p.giveBio(person['name'], 2, userName)
            elif person_name != '':
                p.giveBio(person_name, 2, userName)
            else:
Пример #4
0
     if 'movie' in locals():
         print("IMDBOT: Hmm... let me think...")
         p.otherRoles(person)
     else:
         print("IMDBOT: Sorry i am not sure how to help with that")
 elif (user_input.lower().__contains__('birthday')
       or user_input.lower().__contains__('birth date')):
     #Call giveBio() from person.py
     #Search for birthday/birthdate
     #"What is the birthday of {any actor name} or birthday/birth date of {any actor name}"
     #Problem with code you have to type birthday/birth date of {any actor name}(as a whole sentence) in order of it to work! Working on the fix ASAP
     person = user_input.split(
         "of "
     )[1]  #if user writes 'birthday/birth date of {any actor name}' cuts to '{any actor name}'
     print("IMDBOT: Hmm... let me think...")
     p.giveBio(person, 1)
     print("IMDBOT: What else would you like to know?")
 elif (user_input.lower().__contains__('birth place')):
     #Search for birth place of an actor
     #Example, what is the birth place of {any actor name}
     person = user_input.split(
         "of "
     )[1]  #What is the birth place of {any actor name} cuts to {any actor name}
     print("IMDBOT: Hmm... let me think...")
     p.giveBio(person, 2)
     print("IMDBOT: What else would you like to know?")
 elif (user_input.lower().__contains__('latest movie')):
     #Search for a latest movie by an actor
     #Example, what is the latest movie {any actor name} has worked in
     person = user_input.split("movie ")[1]
     person = person.split("has")[0]