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


Python Interface.request方法代码示例

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


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

示例1: test_request_convert_tenunits

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import request [as 别名]
 def test_request_convert_tenunits(self):
     """
     Test all unit conversions.
     :return:
     """
     qaobject = Interface()
     result = qaobject.request("Convert 10 meters to kilometers")
     self.assertEqual(result, "0.01 kilometers")
     result = qaobject.request("Convert 10 meters to megameters")
     self.assertEqual(result, "0.00001 megameters")
     result = qaobject.request("Convert 10 meters to decameters")
     self.assertEqual(result, "1.0 decameters")
     result = qaobject.request("Convert 10 meters to hectometers")
     self.assertEqual(result, "0.1 hectometers")
     result = qaobject.request("Convert 10 meters to gigameters")
     self.assertEqual(result, "0.00000001 gigameters")
     result = qaobject.request("Convert 10 meters to terameters")
     self.assertEqual(result, "0.00000000001 terameters")
     result = qaobject.request("Convert 10 meters to decimeters")
     self.assertEqual(result, "100.0 decimeters")
     result = qaobject.request("Convert 10 meters to centimeters")
     self.assertEqual(result, "1000.0 centimeters")
     result = qaobject.request("Convert 10 meters to millimeters")
     self.assertEqual(result, "10000.0 millimeters")
     result = qaobject.request("Convert 10 meters to micrometers")
     self.assertEqual(result, "10000000.0 micrometers")
开发者ID:patrickcarlson,项目名称:CST-236,代码行数:28,代码来源:job_story_test.py

示例2: test_request_hoot_update

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import request [as 别名]
 def test_request_hoot_update(self):
     """
     Check that What is OIT question answer overwrites request response
     :return:
     """
     qaobject = Interface()
     qaobject.request("Go Owls!")
     result = qaobject.ask("What is OIT?")
     self.assertEqual(result, "Oregon Institute of Technology")
开发者ID:patrickcarlson,项目名称:CST-236,代码行数:11,代码来源:job_story_test.py

示例3: test_request_clearmemory

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import request [as 别名]
 def test_request_clearmemory(self):
     """
     Tests memory clearing request.
     :return:
     """
     qaobject = Interface()
     qaobject.ask("What color is the cow?")
     qaobject.teach("brown")
     result = qaobject.ask("What color is the cow?")
     self.assertEqual(result, 'brown')
     qaobject.request("Please clear memory")
     result = qaobject.teach('blue')
     self.assertEqual(result, "Please ask a question first")
     result = qaobject.ask("What color is the cow?")
     self.assertEqual(result, "I don't know, please provide the answer")
开发者ID:patrickcarlson,项目名称:CST-236,代码行数:17,代码来源:job_story_test.py

示例4: test_request_hooting

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import request [as 别名]
 def test_request_hooting(self):
     """
     Check Go Owl's request returns correct string.
     :return:
     """
     qaobject = Interface()
     result = qaobject.request("Go Owls!")
     self.assertEqual(result, 'Hoo Hoo')
开发者ID:patrickcarlson,项目名称:CST-236,代码行数:10,代码来源:job_story_test.py

示例5: test_request_convert_unknown

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import request [as 别名]
 def test_request_convert_unknown(self):
     """
     Test invalid entry for units in conversion request.
     :return:
     """
     qaobject = Interface()
     result = qaobject.request("Convert 10 cups to gallons")
     self.assertEqual(result, "Unknown unit")
开发者ID:patrickcarlson,项目名称:CST-236,代码行数:10,代码来源:job_story_test.py

示例6: test_request_convert_single

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import request [as 别名]
 def test_request_convert_single(self):
     """
     Check correct unit conversion.
     :return:
     """
     qaobject = Interface()
     result = qaobject.request("Convert 10 meters to kilometers")
     self.assertEqual(result, "0.01 kilometers")
开发者ID:patrickcarlson,项目名称:CST-236,代码行数:10,代码来源:job_story_test.py

示例7: test_request_hal_open_door

# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import request [as 别名]
 def test_request_hal_open_door(self):
     """
     Tests correct returns of Hal request.
     :return:
     """
     qaobject = Interface()
     result = qaobject.request("Open the door hal")
     halandusername = "I'm afraid I can't do that " + getpass.getuser()
     self.assertEqual(result, halandusername)
开发者ID:patrickcarlson,项目名称:CST-236,代码行数:11,代码来源:job_story_test.py


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