From 8e6ee98ee921ea2f7a3d94dc99e54a9617483831 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 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):