当前位置: 首页>>代码示例>>Python>>正文


Python Interface.teach方法代码示例

本文整理汇总了Python中source.main.Interface.teach方法的典型用法代码示例。如果您正苦于以下问题:Python Interface.teach方法的具体用法?Python Interface.teach怎么用?Python Interface.teach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在source.main.Interface的用法示例。


在下文中一共展示了Interface.teach方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_question_prev_question_known_answer

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import teach [as 别名]
 def test_question_prev_question_known_answer(self):
     new_interface = Interface()
     test_string1 = "How is paul awesome?"
     result = new_interface.ask(test_string1)
     result = new_interface.teach("He just is.")
     result = new_interface.teach("Shouldn't allow change")
     self.assertEqual(result, NO_TEACH)
开发者ID:PaulIvanov,项目名称:CST236-Testing,代码行数:9,代码来源:main_test.py

示例2: test_provide_answer_corrected_square2

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import teach [as 别名]
 def test_provide_answer_corrected_square2(self):
     obj = Interface()
     obj.ask('What type of flamingo is this 1 1 1 1?')
     obj.teach(get_triangle_type)
     obj.correct(get_quad_type)
     result = obj.ask('What type of flamingo is this 1 1 1 1?')
     self.assertEqual(result, 'Square')
开发者ID:Binxyprime,项目名称:softwareTesting,代码行数:9,代码来源:main_test.py

示例3: test_question_ask_90_similar

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import teach [as 别名]
 def test_question_ask_90_similar(self):
     new_interface = Interface()
     test_string = "How is pual awesom?"
     result = new_interface.ask(test_string)
     new_interface.teach("He just is.")
     result = new_interface.ask(test_string)
     self.assertEqual(result, "He just is.")
开发者ID:PaulIvanov,项目名称:CST236-Testing,代码行数:9,代码来源:main_test.py

示例4: test_StoreAnswer_req

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import teach [as 别名]
 def test_StoreAnswer_req(self):
     obj = Interface()
     obj.ask("What type of square is 1 1 1 1?")
     obj.teach(get_triangle_type)
     obj.correct(get_square_type)
     result = obj.ask("What type of square is 1 1 1 1?")
     self.assertEqual(result, "square")
开发者ID:OregonTech,项目名称:JeredS,代码行数:9,代码来源:main_test.py

示例5: test_provide_answer_corrected

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import teach [as 别名]
 def test_provide_answer_corrected(self):
     obj = Interface()
     obj.ask('What color is the sky?')
     obj.teach('The sky is blue')
     obj.correct('The sky is a multitude of colors typically ranging from turquoise to indigo')
     result = obj.ask('What color is the sky?')
     self.assertEqual(result, 'The sky is a multitude of colors typically ranging from turquoise to indigo')
开发者ID:rmkennell,项目名称:CST236,代码行数:9,代码来源:main_test.py

示例6: test_UpdateLearned_req

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import teach [as 别名]
 def test_UpdateLearned_req(self):
     obj = Interface()
     obj.ask("What type of square is 1 1 1 1?")
     obj.teach(get_triangle_type)
     obj.correct(get_square_type)
     result = obj.ask(obj.last_question + "?")
     self.assertEqual(result, "invalid")
开发者ID:OregonTech,项目名称:JeredS,代码行数:9,代码来源:main_test.py

示例7: test_provide_answer_corrected_fptr

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import teach [as 别名]
 def test_provide_answer_corrected_fptr(self):
     obj = Interface()
     obj.ask('What shape is 2 5 2 5?')
     obj.teach(get_triangle_type)
     obj.correct(get_quadrilateral_type)
     result = obj.ask('What shape is 2 5 2 5?')
     self.assertEqual(result, 'rectangle')
开发者ID:rmkennell,项目名称:CST236,代码行数:9,代码来源:main_test.py

示例8: test_provide_answer_corrected_strings

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import teach [as 别名]
 def test_provide_answer_corrected_strings(self):
     obj = Interface()
     obj.ask('Why did ancient egyptians build the pyramids?')
     obj.teach('To honor their royalty in tombs')
     obj.correct('Aliens')
     result = obj.ask('Why did ancient egyptians build the pyramids?')
     self.assertEqual(result, 'Aliens')
开发者ID:rmkennell,项目名称:CST236,代码行数:9,代码来源:main_test.py

示例9: test_provide_answer_corrected_sentence

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import teach [as 别名]
 def test_provide_answer_corrected_sentence(self):
     obj = Interface()
     obj.ask('Why did Abe Lincoln start killing vampires?')
     obj.teach('Because Abe hates glitter')
     obj.correct('Because Abe wants to add to his glitter collection')
     result = obj.ask('Why did Abe Lincoln start killing vampires?')
     self.assertEqual(result, 'Because Abe wants to add to his glitter collection')
开发者ID:Binxyprime,项目名称:softwareTesting,代码行数:9,代码来源:main_test.py

示例10: test_giving_answer

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import teach [as 别名]
 def test_giving_answer(self):
     """ test teaching an answer """
     attempt = Interface()
     question = "How many sides does a quadrilateral have?"
     attempt.ask(question)
     attempt.teach("four sides.")
     result = attempt.ask(question)
     self.assertEqual(result, "four sides.")
开发者ID:david-barnes,项目名称:CST236_Lab7,代码行数:10,代码来源:main_test.py

示例11: test_question_ask_89_similar

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import teach [as 别名]
 def test_question_ask_89_similar(self):
     new_interface = Interface()
     test_string = "How is paul awesome?"
     result = new_interface.ask(test_string)
     new_interface.teach("He just is.")
     test_string2 = "How is pual awesum?"
     result = new_interface.ask(test_string2)
     self.assertEqual(result, UNKNOWN_QUESTION)
开发者ID:PaulIvanov,项目名称:CST236-Testing,代码行数:10,代码来源:main_test.py

示例12: test_question_ask_0_similar

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import teach [as 别名]
 def test_question_ask_0_similar(self):
     new_interface = Interface()
     test_string1 = "How is paul awesome?"
     result = new_interface.ask(test_string1)
     new_interface.teach("He just is.")
     dif_str = "jack do knot scar."
     result = new_interface.ask(dif_str)
     self.assertEqual(result, NOT_A_QUESTION_RETURN)
开发者ID:PaulIvanov,项目名称:CST236-Testing,代码行数:10,代码来源:main_test.py

示例13: test_job_story_clear

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import teach [as 别名]
 def test_job_story_clear(self):
     ''' test to see if the user set question answers are cleared '''
     attempt = Interface()
     attempt.ask("What is the meaning of life?")
     attempt.teach("42")
     attempt.ask("Please clear memory?")
     result4 = attempt.ask("What is the meaning of life?")
     self.assertEqual(result4, "I don't know, please provide the answer")
开发者ID:david-barnes,项目名称:CST236_Lab7,代码行数:10,代码来源:answers_test.py

示例14: test_story_clear_mem_teach

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import teach [as 别名]
 def test_story_clear_mem_teach(self):
     obj = Interface()
     obj.ask('Why did Abe Lincoln start killing vampires?')
     obj.teach('Because Abe hates glitter')
     obj.ask('Why did Abe Lincoln start killing vampires?')
     obj.ask("Please clear memory?")
     result = obj.ask('Why did Abe Lincoln start killing vampires?')
     self.assertEqual(result, 'I don\'t know, please provide the answer')
开发者ID:Binxyprime,项目名称:softwareTesting,代码行数:10,代码来源:story_test.py

示例15: test_previous_question_answer

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import teach [as 别名]
 def test_previous_question_answer(self):
     '''
     This tests the interface for previous question teaching.
     '''
     interface = Interface()
     interface.ask("What makes you think she is a witch?")
     interface.teach("Oh, she turned me into a newt!")
     result = interface.ask("What makes you think she is a witch?")
     self.assertEqual(result, "Oh, she turned me into a newt!")
开发者ID:Hyatus,项目名称:CST236Lab7,代码行数:11,代码来源:qa_checker_test.py


注:本文中的source.main.Interface.teach方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。