-
Notifications
You must be signed in to change notification settings - Fork 362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Verify Content-Encoding when querying Content-Length #1320
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
|
||
import fsspec.asyn | ||
import fsspec.utils | ||
from fsspec.implementations.http import HTTPStreamFile | ||
from fsspec.tests.conftest import data, reset_files, server, win # noqa: F401 | ||
|
||
|
||
|
@@ -280,6 +281,18 @@ def test_content_length_zero(server): | |
assert f.read() == data | ||
|
||
|
||
def test_content_encoding_gzip(server): | ||
h = fsspec.filesystem( | ||
"http", headers={"give_length": "true", "gzip_encoding": "true"} | ||
) | ||
url = server + "/index/realfile" | ||
|
||
with h.open(url, "rb") as f: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, not super familiar with fsspec, yet - Only tried to mimic the test above this one. Added assertions for type and size, now. |
||
assert isinstance(f, HTTPStreamFile) | ||
assert f.size is None | ||
assert f.read() == data | ||
|
||
|
||
def test_download(server, tmpdir): | ||
h = fsspec.filesystem("http", headers={"give_length": "true", "head_ok": "true "}) | ||
url = server + "/index/realfile" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise is remains
None
and can only be streamed? That is probably right, but could use some tests to make sure we are getting the right behaviour.