當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。