diff --git a/rest_framework/views.py b/rest_framework/views.py index da85cccec8..bec10560a9 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 eb34a6c913..d5a61232d9 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_negative(self): self.set_throttle_timer(MockView_DoubleThrottling, 0) request = self.factory.get('/') for dummy in range(24):