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


Python Interface.ask方法代码示例

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


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

示例1: test_provide_answer_corrected_sentence

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import ask [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

示例2: test_question_ask_90_similar

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import ask [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

示例3: test_question_prev_function_ptr

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import ask [as 别名]
 def test_question_prev_function_ptr(self):
     new_interface = Interface()
     test_string1 = "How did a function ptr get here?"
     result = new_interface.ask(test_string1)
     result = new_interface.teach(get_quadrilateral_type)
     result = new_interface.ask(test_string1)
     self.assertEqual(result, "invalid")
开发者ID:PaulIvanov,项目名称:CST236-Testing,代码行数:9,代码来源:main_test.py

示例4: test_giving_answer_known

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import ask [as 别名]
 def test_giving_answer_known(self):
     """ test teaching an answer to a question with a known answer  """
     attempt = Interface()
     question = "What type of quadrilateral is ?"
     attempt.ask(question)
     result = attempt.teach("square")
     self.assertEqual(result, "I don't know about that. I was taught differently")
开发者ID:david-barnes,项目名称:CST236_Lab7,代码行数:9,代码来源:main_test.py

示例5: test_provide_answer_corrected

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import ask [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_StoreAnswer_req

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import ask [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

示例7: test_questions_keywords

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import ask [as 别名]
 def test_questions_keywords(self):
     x = Interface()
     self.assertEqual(x.ask(question="How ?"), "I don't know, please provide the answer")
     self.assertEqual(x.ask(question="How ?"), "I don't know, please provide the answer")
     self.assertEqual(x.ask(question="Where ?"), "I don't know, please provide the answer")
     self.assertEqual(x.ask(question="Who ?"), "I don't know, please provide the answer")
     self.assertEqual(x.ask(question="Why ?"), "I don't know, please provide the answer")
开发者ID:OregonTech,项目名称:ZaidR,代码行数:9,代码来源:shape_checker_test.py

示例8: test_UpdateLearned_req

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import ask [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

示例9: test_provide_answer_corrected_fptr

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import ask [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

示例10: test_provide_answer_corrected_strings

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import ask [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

示例11: test_provide_answer_corrected_square2

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import ask [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

示例12: test_numberic_conversion

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import ask [as 别名]
 def test_numberic_conversion(self):
     '''
     This function tests the interface for multiple unit conversion.
     '''
     interface = Interface()
     result1 = interface.ask("Convert 1 meter to gigameters")
     self.assertEqual(result1, "1e-09 gigameters")
     result2 = interface.ask("Convert 1 meter to megameters")
     self.assertEqual(result2, "1e-06 megameters")
     result3 = interface.ask("Convert 1 meter to kilometers")
     self.assertEqual(result3, "0.001 kilometers")
     result4 = interface.ask("Convert 1 meter to hectometers")
     self.assertEqual(result4, "0.01 hectometers")
     result5 = interface.ask("Convert 10 meter to decameters")
     self.assertEqual(result5, "1 decameter")
     result6 = interface.ask("Convert 1 meter to decimeters")
     self.assertEqual(result6, "10.0 decimeters")
     result7 = interface.ask("Convert 1 meter to centimeters")
     self.assertEqual(result7, "100.0 centimeters")
     result8 = interface.ask("Convert 1 meter to millimeters")
     self.assertEqual(result8, "1000.0 millimeters")
     result9 = interface.ask("Convert 1 meter to micrometers")
     self.assertEqual(result9, "1000000.0 micrometers")
     result10 = interface.ask("Convert 1 meter to nanometers")
     self.assertEqual(result10, "1000000000.0 nanometers")
开发者ID:Hyatus,项目名称:CST236Lab7,代码行数:27,代码来源:interface_test.py

示例13: test_question_ask_0_similar

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import ask [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

示例14: test_question_ask_89_similar

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import ask [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

示例15: test_job_story_clear

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import ask [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


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