本文整理汇总了Python中source.main.Interface.correct方法的典型用法代码示例。如果您正苦于以下问题:Python Interface.correct方法的具体用法?Python Interface.correct怎么用?Python Interface.correct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类source.main.Interface
的用法示例。
在下文中一共展示了Interface.correct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_UpdateLearned_req
# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import correct [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")
示例2: test_StoreAnswer_req
# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import correct [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")
示例3: test_provide_answer_corrected_fptr
# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import correct [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')
示例4: test_provide_answer_corrected_square2
# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import correct [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')
示例5: test_provide_answer_corrected
# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import correct [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')
示例6: test_provide_answer_corrected_strings
# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import correct [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')
示例7: test_provide_answer_corrected_sentence
# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import correct [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')
示例8: test_question_ask_correct_valid
# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import correct [as 别名]
def test_question_ask_correct_valid(self):
new_interface = Interface()
test_string = "How is paul awesome?"
result = new_interface.ask(test_string)
new_interface.teach("He just is.")
new_interface.correct("He is not awesome")
result = new_interface.ask(test_string)
self.assertEqual(result, "He is not awesome")
示例9: test_correcting_answer
# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import correct [as 别名]
def test_correcting_answer(self):
""" test correcting an answer """
attempt = Interface()
question = "How many sides and corners does a quadrilateral have?"
attempt.ask(question)
attempt.teach("four sides.")
attempt.correct("four sides and corners.")
result = attempt.ask(question)
self.assertEqual(result, "four sides and corners.")
示例10: test_update_answered_question
# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import correct [as 别名]
def test_update_answered_question(self):
'''
This tests the interface for updating an answer with correct().
'''
interface = Interface()
interface.ask("What is your name?")
interface.teach("My name is Sir Lancelot of Camelot.")
interface.ask("What is your name?")
interface.correct("Sir Robin of Camelot.")
result = interface.ask("What is your name?")
self.assertEqual(result, "Sir Robin of Camelot.")
示例11: test_question_updateanswer
# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import correct [as 别名]
def test_question_updateanswer(self):
"""
Check that correct function performs correctly.
:return:
"""
qaobject = Interface()
qaobject.ask("What triangle is: 5, 6, 5?")
qaobject.teach("scalene")
result = qaobject.ask("What triangle is: 5, 6, 5?")
self.assertEqual(result, "scalene")
qaobject.correct("isosceles")
result = qaobject.ask("What triangle is: 5, 6, 5?")
self.assertEqual(result, "isosceles")
示例12: test_job_story_case_fib
# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import correct [as 别名]
def test_job_story_case_fib(self):
"""
Test job story case fib
:return: assertion that the system returns the correct digit of the fibonacci
sequence
"""
inquiry = Interface()
inquiry.ask("What is the 5 digit of fibonacci?")
inquiry.teach(fib(9))
result = inquiry.ask("What is the 5 digit of fibonacci?")
self.assertEqual(result, 34)
inquiry.ask("What is the 0 digit of fibonacci?")
inquiry.correct(fib(0))
result = inquiry.ask("What is the 0 digit of fibonacci?")
self.assertEqual(result, 0)
示例13: test_answer
# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import correct [as 别名]
def test_answer(self):
x = Interface()
start = time.clock()
val = x.correct("No respond")
proc_time = time.clock() - start
self.assertTrue(val)
self.assertLessEqual(proc_time, 0.5)
示例14: test_ask_no_correct
# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import correct [as 别名]
def test_ask_no_correct(self):
"""
Test correct function, no question
:return: assertion: ask question first
"""
inquiry = Interface()
result = inquiry.correct('polygon')
self.assertEqual(result, 'Please ask a question first')
示例15: test_correct_no_question
# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import correct [as 别名]
def test_correct_no_question(self):
"""
func that test for questions and answers
:rtype: object
"""
value = Interface()
self.assertEqual(value.correct(answer="Inside the bag"), 'Please ask a question first')