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


Python UasTelemetry.last_for_user方法代码示例

本文整理汇总了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)
开发者ID:auvsi-suas,项目名称:interop,代码行数:17,代码来源:access_log_test.py

示例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)
开发者ID:auvsi-suas,项目名称:interop,代码行数:11,代码来源:access_log_test.py

示例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
    }
开发者ID:auvsi-suas,项目名称:interop,代码行数:13,代码来源:teams.py

示例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)
开发者ID:auvsi-suas,项目名称:interop,代码行数:14,代码来源:access_log_test.py

示例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))
开发者ID:auvsi-suas,项目名称:interop,代码行数:14,代码来源:access_log_test.py


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