Skip to content

Commit

Permalink
extra asserts that file is not None
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchainz committed Jan 29, 2023
1 parent 2441cb7 commit ebff43e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/test_whitenoise.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ def test_last_modified_not_set_when_mtime_is_zero():
stat_cache = {__file__: fake_stat_entry()}
responder = StaticFile(__file__, [], stat_cache=stat_cache)
response = responder.get_response("GET", {})
assert response.file is not None
response.file.close()
headers_dict = Headers(response.headers)
assert "Last-Modified" not in headers_dict
Expand All @@ -369,6 +370,7 @@ def test_file_size_matches_range_with_range_header():
stat_cache = {__file__: fake_stat_entry()}
responder = StaticFile(__file__, [], stat_cache=stat_cache)
response = responder.get_response("GET", {"HTTP_RANGE": "bytes=0-13"})
assert response.file is not None
file_size = len(response.file.read())
assert file_size == 14

Expand Down

0 comments on commit ebff43e

Please sign in to comment.