本文整理汇总了Python中TestHelper.TestHelper.run_test方法的典型用法代码示例。如果您正苦于以下问题:Python TestHelper.run_test方法的具体用法?Python TestHelper.run_test怎么用?Python TestHelper.run_test使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestHelper.TestHelper
的用法示例。
在下文中一共展示了TestHelper.run_test方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: can_build_record
# 需要导入模块: from TestHelper import TestHelper [as 别名]
# 或者: from TestHelper.TestHelper import run_test [as 别名]
# Id,ActionTypeId,MemberId,Created,CampaignId,TrademarkId,ProductTypeId,InventoryId,CategoryId,CustomListId,Identifier,UserIp,Url,RefererUrl,UserAgentString,ExtraData
line = "1,2,3,1/20/2012 13:53,,,,,,,,1.2.3.4,,,,"
res = walp.parse_line(line)
th.should_be(res[walp.ID], 1)
th.should_be(res[walp.ACTION_TYPE_ID], 2)
th.should_be(res[walp.MEMBER_ID], 3)
th.should_be(res[walp.ACTIVITY_DATE], "1/20/2012 13:53")
th.should_be(res[walp.CAMPAIGN_ID], None)
th.should_be(res[walp.TRADEMARK_ID], None)
th.should_be(res[walp.PRODUCT_TYPE_ID], None)
th.should_be(res[walp.INVENTORY_ID], None)
th.should_be(res[walp.CATEGORY_ID], None)
th.should_be(res[walp.CUSTOM_LIST_ID], None)
th.should_be(res[walp.IDENTIFIER], None)
th.should_be(res[walp.USER_IP], "1.2.3.4")
th.should_be(res[walp.REQUESTED_URL], "")
th.should_be(res[walp.USER_AGENT], "")
th.should_be(res[walp.EXTRA_DATA], "")
def can_build_record(th):
line = "1,2,3,1/20/2012 13:53,4,5,6,7,8,9,10,212.156.132.66,http://localhost:8080/markalar/4/,REF,Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1,EXD"
record = WebActivityRecord(line)
th.should_be(record.day_of_week, 4)
th.should_be(record.category_id, 8)
if __name__ == "__main__":
th = TestHelper()
th.run_test(test_line_parser_all_fields)
th.run_test(test_line_parser_missing_fields)
th.run_test(can_build_record)