當前位置: 首頁>>代碼示例>>Python>>正文


Python AccessLog.rates方法代碼示例

本文整理匯總了Python中auvsi_suas.models.AccessLog.rates方法的典型用法代碼示例。如果您正苦於以下問題:Python AccessLog.rates方法的具體用法?Python AccessLog.rates怎麽用?Python AccessLog.rates使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在auvsi_suas.models.AccessLog的用法示例。


在下文中一共展示了AccessLog.rates方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_no_data

# 需要導入模塊: from auvsi_suas.models import AccessLog [as 別名]
# 或者: from auvsi_suas.models.AccessLog import rates [as 別名]
    def test_no_data(self):
        logs = AccessLog.by_user(self.user1)
        self.assertEqual(len(logs), 0)

        logs = AccessLog.by_time_period(self.user1, [])
        self.assertEqual(len(logs), 0)

        log_rates = AccessLog.rates(self.user1, [])
        self.assertTupleEqual(log_rates, (None, None))
開發者ID:CnuUasLab,項目名稱:interop,代碼行數:11,代碼來源:access_log_test.py

示例2: test_ignore_start_end

# 需要導入模塊: from auvsi_suas.models import AccessLog [as 別名]
# 或者: from auvsi_suas.models.AccessLog import rates [as 別名]
    def test_ignore_start_end(self):
        """When start and end are None, only times between logs are compared."""
        delta = datetime.timedelta(seconds=1)

        logs = self.create_logs(self.user1, delta=delta)
        period = TimePeriod(None, None)

        rates = AccessLog.rates(self.user1, [period])

        self.assertSequenceEqual((1, 1), rates)
開發者ID:APTRG,項目名稱:interop,代碼行數:12,代碼來源:access_log_test.py

示例3: test_constant_rate

# 需要導入模塊: from auvsi_suas.models import AccessLog [as 別名]
# 或者: from auvsi_suas.models.AccessLog import rates [as 別名]
    def test_constant_rate(self):
        """Rates computed correctly."""
        delta = datetime.timedelta(seconds=1)

        logs = self.create_logs(self.user1, delta=delta)
        period = self.consistent_period(logs, delta)

        rates = AccessLog.rates(self.user1, [period])

        self.assertSequenceEqual((1, 1), rates)
開發者ID:APTRG,項目名稱:interop,代碼行數:12,代碼來源:access_log_test.py

示例4: test_provided_logs

# 需要導入模塊: from auvsi_suas.models import AccessLog [as 別名]
# 或者: from auvsi_suas.models.AccessLog import rates [as 別名]
    def test_provided_logs(self):
        """Rates computed with provided logs."""
        delta = datetime.timedelta(seconds=1)

        used_logs = self.create_logs(self.user1, delta=delta)
        unused_logs = self.create_logs(self.user1, delta=delta)
        period = self.consistent_period(used_logs, delta)

        rates = AccessLog.rates(self.user1, [period],
                                time_period_logs=[used_logs])

        self.assertSequenceEqual((1, 1), rates)
開發者ID:CnuUasLab,項目名稱:interop,代碼行數:14,代碼來源:access_log_test.py

示例5: test_multiple_periods

# 需要導入模塊: from auvsi_suas.models import AccessLog [as 別名]
# 或者: from auvsi_suas.models.AccessLog import rates [as 別名]
    def test_multiple_periods(self):
        """Multiple periods are combined without introducing errors."""
        delta = datetime.timedelta(seconds=1)

        logs = [
            self.create_logs(self.user1,
                             start=self.year2000,
                             delta=delta),
            self.create_logs(self.user1,
                             start=self.year2001,
                             delta=delta),
        ]

        periods = [self.consistent_period(l, delta) for l in logs]

        rates = AccessLog.rates(self.user1, periods)

        self.assertSequenceEqual((1, 1), rates)
開發者ID:APTRG,項目名稱:interop,代碼行數:20,代碼來源:access_log_test.py

示例6: test_different_deltas

# 需要導入模塊: from auvsi_suas.models import AccessLog [as 別名]
# 或者: from auvsi_suas.models.AccessLog import rates [as 別名]
    def test_different_deltas(self):
        """Sets of logs are combined for overall rates."""
        delta = datetime.timedelta(seconds=1)

        logs = [
            self.create_logs(self.user1,
                             num=1000,
                             start=self.year2000,
                             delta=delta),
            self.create_logs(self.user1,
                             num=1000,
                             start=self.year2001,
                             delta=delta / 2),
        ]

        periods = [self.consistent_period(l, delta) for l in logs]

        rates = AccessLog.rates(self.user1, periods)

        self.assertAlmostEqual(1.0, rates[0])  # max
        self.assertAlmostEqual(0.75, rates[1], delta=0.001)  # avg
開發者ID:APTRG,項目名稱:interop,代碼行數:23,代碼來源:access_log_test.py


注:本文中的auvsi_suas.models.AccessLog.rates方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。