From f72e4083e248644fc11f80f5eaab502752328ef3 Mon Sep 17 00:00:00 2001 From: Christopher Grebs Date: Wed, 7 Aug 2019 10:48:15 +0200 Subject: [PATCH] Use default argument of max() and change test name --- rest_framework/views.py | 2 +- tests/test_throttling.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rest_framework/views.py b/rest_framework/views.py index da85cccec83..bec10560a93 100644 --- a/rest_framework/views.py +++ b/rest_framework/views.py @@ -363,7 +363,7 @@ def check_throttles(self, request): if duration is not None ] - duration = max(durations) if durations else None + duration = max(durations, default=None) self.throttled(request, duration) def determine_version(self, request, *args, **kwargs): diff --git a/tests/test_throttling.py b/tests/test_throttling.py index eb34a6c913e..78c82239c53 100644 --- a/tests/test_throttling.py +++ b/tests/test_throttling.py @@ -159,7 +159,7 @@ def test_request_throttling_multiple_throttles(self): assert response.status_code == 429 assert int(response['retry-after']) == 58 - def test_handle_negative_throttle_value(self): + def test_throttle_rate_change(self): self.set_throttle_timer(MockView_DoubleThrottling, 0) request = self.factory.get('/') for dummy in range(24):