本文整理汇总了Python中auvsi_suas.models.uas_telemetry.UasTelemetry.last_for_user方法的典型用法代码示例。如果您正苦于以下问题:Python UasTelemetry.last_for_user方法的具体用法?Python UasTelemetry.last_for_user怎么用?Python UasTelemetry.last_for_user使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类auvsi_suas.models.uas_telemetry.UasTelemetry
的用法示例。
在下文中一共展示了UasTelemetry.last_for_user方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_last_for_user_time_restrict
# 需要导入模块: from auvsi_suas.models.uas_telemetry import UasTelemetry [as 别名]
# 或者: from auvsi_suas.models.uas_telemetry.UasTelemetry import last_for_user [as 别名]
def test_last_for_user_time_restrict(self):
start = timezone.now()
delta = datetime.timedelta(seconds=1)
logs = self.create_logs(self.user1, num=10, start=start, delta=delta)
log = UasTelemetry.last_for_user(self.user1,
start_time=start,
end_time=start + delta * 3)
self.assertEqual(logs[2], log)
log = UasTelemetry.last_for_user(self.user1,
start_time=start + delta * 11)
self.assertIsNone(log)
log = UasTelemetry.last_for_user(self.user1, end_time=start - delta)
self.assertIsNone(log)
示例2: test_basic_access
# 需要导入模块: from auvsi_suas.models.uas_telemetry import UasTelemetry [as 别名]
# 或者: from auvsi_suas.models.uas_telemetry.UasTelemetry import last_for_user [as 别名]
def test_basic_access(self):
start = timezone.now() - datetime.timedelta(seconds=10)
logs = self.create_logs(self.user1, start=start)
log = UasTelemetry.last_for_user(self.user1)
self.assertEqual(logs[-1], log)
results = UasTelemetry.by_user(self.user1)
self.assertSequenceEqual(logs, results)
示例3: user_json
# 需要导入模块: from auvsi_suas.models.uas_telemetry import UasTelemetry [as 别名]
# 或者: from auvsi_suas.models.uas_telemetry.UasTelemetry import last_for_user [as 别名]
def user_json(user):
"""Generate JSON-style dict for user."""
telemetry = UasTelemetry.last_for_user(user)
return {
'name': user.username,
'id': user.pk,
'on_clock': MissionClockEvent.user_on_clock(user),
'on_timeout': MissionClockEvent.user_on_timeout(user),
'in_air': TakeoffOrLandingEvent.user_in_air(user),
'telemetry': telemetry.json() if telemetry else None
}
示例4: test_multi_user
# 需要导入模块: from auvsi_suas.models.uas_telemetry import UasTelemetry [as 别名]
# 或者: from auvsi_suas.models.uas_telemetry.UasTelemetry import last_for_user [as 别名]
def test_multi_user(self):
# Intersperse logs from two users
logs = []
for _ in xrange(10):
logs += self.create_logs(self.user1, num=1)
self.create_logs(self.user2, num=1)
log = UasTelemetry.last_for_user(self.user1)
self.assertEqual(logs[-1], log)
results = UasTelemetry.by_user(self.user1)
self.assertSequenceEqual(logs, results)
示例5: test_no_data
# 需要导入模块: from auvsi_suas.models.uas_telemetry import UasTelemetry [as 别名]
# 或者: from auvsi_suas.models.uas_telemetry.UasTelemetry import last_for_user [as 别名]
def test_no_data(self):
log = UasTelemetry.last_for_user(self.user1)
self.assertEqual(None, log)
logs = UasTelemetry.by_user(self.user1)
self.assertEqual(len(logs), 0)
logs = UasTelemetry.by_time_period(self.user1, [])
self.assertSequenceEqual([], logs)
log_rates = UasTelemetry.rates(self.user1, [])
self.assertTupleEqual(log_rates, (None, None))