Poolitzer · GitHub

@Poolitzer

@Poolitzer Poolitzer changed the title Feat: File.download, merge out and custom_path into out Feat: Rewrite File.download into download_to_drive and download_to_object

Sep 12, 2022

@Poolitzer

@Poolitzer

I dont get codecov path, test_download_file_obj covers that, no?

async def test_download_file_obj(self, monkeypatch, file):
async def test(*args, **kwargs):
return self.file_content
monkeypatch.setattr(file.get_bot().request, "retrieve", test)
with TemporaryFile() as custom_fobj:
out_fobj = await file.download_to_object(out=custom_fobj)
assert out_fobj is custom_fobj
out_fobj.seek(0)
assert out_fobj.read() == self.file_content

Edit: Doesn't complain anymore. I think it has seen its error :D

Bibo-Joshi

Co-authored-by: Bibo-Joshi <22366557+Bibo-Joshi@users.noreply.github.com>

harshil21

Co-authored-by: Harshil <37377066+harshil21@users.noreply.github.com>
Also improved docs for the tests

harshil21

Bibo-Joshi

__version_info__ = (0, 0, 0, 0, 0) # type: ignore[assignment]

if __version_info__ < (20, 0, 0, "alpha", 1):
if __version_info__ < (20, 0, 0, "alpha", 5):
Also rename to_drive to to_memory
Co-authored-by: Bibo-Joshi <22366557+Bibo-Joshi@users.noreply.github.com>

Bibo-Joshi

harshil21

@Bibo-Joshi

@Bibo-Joshi

Read the original on github.com ↗