本文整理汇总了Python中source.main.Interface类的典型用法代码示例。如果您正苦于以下问题:Python Interface类的具体用法?Python Interface怎么用?Python Interface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Interface类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_question_prev_function_ptr
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,代码行数:7,代码来源:main_test.py
示例2: test_fibonacci_digit
def test_fibonacci_digit(self):
'''
This function tests the interface for the fibonacci sequence.
'''
interface = Interface()
result = interface.ask("What is the 10 digit of fibonacci?")
self.assertEqual(result, 34)
开发者ID:Hyatus,项目名称:CST236Lab7,代码行数:7,代码来源:interface_test.py
示例3: test_set_user_name
def test_set_user_name(self):
'''
This function tests the interface for username recognition.
'''
interface = Interface()
result = interface.set_user("Dave")
self.assertEqual(result, "Hello, Dave.")
开发者ID:Hyatus,项目名称:CST236Lab7,代码行数:7,代码来源:interface_test.py
示例4: test_numberic_no_conversion
def test_numberic_no_conversion(self):
'''
This function tests the interface for incorrect unit conversion.
'''
interface = Interface()
result = interface.ask("Convert 1 meter to quadrillometers")
self.assertEqual(result, "Sorry, I can't convert that.")
开发者ID:Hyatus,项目名称:CST236Lab7,代码行数:7,代码来源:interface_test.py
示例5: test_current_directory
def test_current_directory(self):
'''
This function tests the interface for current directory retrieval.
'''
interface = Interface()
result = interface.ask("What directory is this using?")
self.assertEqual(result.lower(), os.getcwd().lower())
开发者ID:Hyatus,项目名称:CST236Lab7,代码行数:7,代码来源:interface_test.py
示例6: test_questions_keywords
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,代码行数:7,代码来源:shape_checker_test.py
示例7: test_answer
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)
开发者ID:OregonTech,项目名称:ZaidR,代码行数:7,代码来源:shape_checker_test.py
示例8: test_fileStatus_Dirty
def test_fileStatus_Dirty(self, mock_dirty, mock_untracked, mock_diff):
obj = Interface()
mock_diff.return_value = []
mock_dirty.return_value = True
mock_untracked.return_value = []
result = obj.ask('What is the status of <requirements.txt>?')
self.assertEqual(result, 'requirements.txt is a dirty repo')
开发者ID:JeredSundquist,项目名称:CST236---Software-Testing,代码行数:7,代码来源:mock_req_test.py
示例9: test_ask_open_door
def test_ask_open_door(self):
new_interface = Interface()
start_time = time.clock()
result = new_interface.ask("Open the door hal!")
end_time = time.clock()
self.assertLess(end_time - start_time, .05)
self.assertEqual(result, "I'm afraid I can't do that " + getpass.getuser())
开发者ID:hpainter2002,项目名称:CST238_SoftwareTesting,代码行数:7,代码来源:job_story_case_test.py
示例10: test_ask_who_let_dogs_out
def test_ask_who_let_dogs_out(self):
obj = Interface()
question = 'Who let the dogs out?'
result = obj.ask(question)
output_to_file(question, result)
self.assertEqual(result, getpass.getuser() + ' let the dogs out')
开发者ID:rmkennell,项目名称:CST236,代码行数:7,代码来源:job_story_test.py
示例11: test_get_git_file_info_upToDate
def test_get_git_file_info_upToDate(self, mock_is_repo_dirty, mock_get_untracked_files, mock_get_diff_files):
obj = Interface()
mock_get_diff_files.return_value = []
mock_get_untracked_files.return_value = []
mock_is_repo_dirty.return_value = False
result = obj.ask('What is the status of <requirements.txt>?')
self.assertEqual(result, 'requirements.txt is up to date')
开发者ID:JeredSundquist,项目名称:CST236---Software-Testing,代码行数:7,代码来源:mock_req_test.py
示例12: test_hello_valid
def test_hello_valid(self):
new_interface = Interface()
test_string1 = "Hello?"
result = new_interface.ask(test_string1)
user = getuser()
expected_result = ("Hello, I am " + user + "'s guide.")
self.assertEqual(result, expected_result)
开发者ID:PaulIvanov,项目名称:CST236-Testing,代码行数:7,代码来源:main_test.py
示例13: test_open_door
def test_open_door(self):
new_interface = Interface()
test_string1 = "Open the door hal."
result = new_interface.ask(test_string1)
expected_user = getuser()
expected_result = ("I'm afraid I can't do that " + expected_user)
self.assertEqual(result, expected_result)
开发者ID:PaulIvanov,项目名称:CST236-Testing,代码行数:7,代码来源:main_test.py
示例14: test_question_datetime_correct
def test_question_datetime_correct(self):
new_interface = Interface()
test_string1 = "What time is it?"
result = new_interface.ask(test_string1)
curr_time = datetime.now()
curr_time = curr_time.replace(second=0, microsecond=0)
self.assertEqual(result, str(curr_time))
开发者ID:PaulIvanov,项目名称:CST236-Testing,代码行数:7,代码来源:main_test.py
示例15: test_ask_not_string
def test_ask_not_string(self):
"""
Test ask function not string
:return: assertion: exception: not string
"""
inquiry = Interface()
self.assertRaises(Exception, lambda: inquiry.ask(12))
开发者ID:Derek132435,项目名称:CST-236-Lab-7,代码行数:7,代码来源:shape_checker_test.py
示例16: test_convert_cm_m_int
def test_convert_cm_m_int(self):
new_interface = Interface()
start_time = time.clock()
result = new_interface.ask("Convert 500 cm to m.")
end_time = time.clock()
self.assertLess(end_time - start_time, .05)
self.assertEqual(result, 5)
开发者ID:hpainter2002,项目名称:CST238_SoftwareTesting,代码行数:7,代码来源:job_story_case_test.py
示例17: test_question4
def test_question4(self):
x = Interface()
start = time.clock()
val = x.ask("1236")
proc_time = time.clock() - start
self.assertTrue(val)
self.assertLessEqual(proc_time, 0.5)
开发者ID:OregonTech,项目名称:ZaidR,代码行数:7,代码来源:shape_checker_test.py
示例18: test_my_add_int
def test_my_add_int(self):
new_interface = Interface()
start_time = time.clock()
result = new_interface.ask("Please add 1 and 2.")
end_time = time.clock()
self.assertLess(end_time - start_time, .05)
self.assertEqual(result, 3)
开发者ID:hpainter2002,项目名称:CST238_SoftwareTesting,代码行数:7,代码来源:job_story_case_test.py
示例19: test_question5
def test_question5(self):
x = Interface()
start = time.clock()
val = x.ask("Why are you like this???")
proc_time = time.clock() - start
self.assertTrue(val)
self.assertLessEqual(proc_time, 0.5)
开发者ID:OregonTech,项目名称:ZaidR,代码行数:7,代码来源:shape_checker_test.py
示例20: test_my_subtract_float
def test_my_subtract_float(self):
new_interface = Interface()
start_time = time.clock()
result = new_interface.ask("Please subtract 1.0 and 2.0.")
end_time = time.clock()
self.assertLess(end_time - start_time, .05)
self.assertEqual(result, -1.0)
开发者ID:hpainter2002,项目名称:CST238_SoftwareTesting,代码行数:7,代码来源:job_story_case_test.py
注:本文中的source.main.Interface类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论