本文整理汇总了Python中socorro.external.postgresql.crashes.Crashes.get_daily方法的典型用法代码示例。如果您正苦于以下问题:Python Crashes.get_daily方法的具体用法?Python Crashes.get_daily怎么用?Python Crashes.get_daily使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类socorro.external.postgresql.crashes.Crashes
的用法示例。
在下文中一共展示了Crashes.get_daily方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_daily
# 需要导入模块: from socorro.external.postgresql.crashes import Crashes [as 别名]
# 或者: from socorro.external.postgresql.crashes.Crashes import get_daily [as 别名]
def test_get_daily(self):
crashes = Crashes(config=self.config)
now = self.now.date()
today = now.isoformat()
yesterday = (now - datetime.timedelta(days=1)).isoformat()
# Test 1: one product, one version (simple version)
params = {
"product": "Firefox",
"versions": ["11.0"]
}
res_expected = {
"hits": {
"Firefox:11.0": {
today: {
"product": "Firefox",
"version": "11.0",
"date": today,
"report_count": 5,
"adu": 20,
"crash_hadu": 0.12
}
}
}
}
res = crashes.get_daily(**params)
eq_(res, res_expected)
# Test 2: one product, several versions, range by build date,
# simple version
params = {
"product": "Firefox",
"versions": ["11.0", "12.0"],
"date_range_type": "build"
}
res_expected = {
"hits": {
"Firefox:11.0": {
today: {
"product": "Firefox",
"version": "11.0",
"date": today,
"report_count": 5,
"adu": 200,
"crash_hadu": 25.0
},
yesterday: {
"product": "Firefox",
"version": "11.0",
"date": yesterday,
"report_count": 3,
"adu": 274,
"crash_hadu": 10.949
}
},
"Firefox:12.0": {
today: {
"product": "Firefox",
"version": "12.0",
"date": today,
"report_count": 3,
"adu": 109,
"crash_hadu": 27.523
}
}
}
}
res = crashes.get_daily(**params)
eq_(res, res_expected)
# Test 3: report type filter, complex version
params = {
"product": "Firefox",
"versions": ["13.0"],
"report_type": "hang"
}
res_expected = {
"hits": {
"Firefox:13.0": {
today: {
"product": "Firefox",
"version": "13.0",
"date": today,
"report_count": 90,
"adu": 12000,
"crash_hadu": 0.75,
"throttle": 0.1
}
}
}
}
res = crashes.get_daily(**params)
eq_(res, res_expected)
# Test 4: extended fields, by build date and with report type,
# complex version
params = {
#.........这里部分代码省略.........