Skip to content

Commit

Permalink
Use default argument of max() and change test name
Browse files Browse the repository at this point in the history
  • Loading branch information
EnTeQuAk committed Aug 7, 2019
1 parent 957b39f commit 8e6ee98
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rest_framework/views.py
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_throttling.py
Expand Up @@ -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):
Expand Down

0 comments on commit 8e6ee98

Please sign in to comment.