MCPcopy Index your code
hub / github.com/PyGithub/PyGithub / testDownloadAssetFile

Method testDownloadAssetFile

tests/GitReleaseAsset.py:75–93  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

73
74 @skipIf(os.name == "nt", "not working on Windows")
75 def testDownloadAssetFile(self):
76 with NamedTemporaryFile(mode="rb") as file:
77 self.asset.download_asset(file.name)
78 content = file.read()
79 self.assertEqual(len(content), 2524)
80 self.assertEqual(
81 content[:172],
82 b"# PyGitHub\n\n"
83 b"[![PyPI](https://img.shields.io/pypi/v/PyGithub.svg)](https://pypi.python.org/pypi/PyGithub)\n"
84 b"![CI](https://github.com/PyGithub/PyGithub/workflows/CI/badge.svg)\n",
85 )
86 self.assertEqual(content[-50:], b"send an email to someone in the MAINTAINERS file.\n")
87
88 source_asset = self.release.assets[1]
89 with NamedTemporaryFile(mode="rb") as file:
90 source_asset.download_asset(file.name)
91 content = file.read()
92 self.assertEqual(len(content), 1199)
93 self.assertEqual(content[:19], b"\x1f\x8b\x08\x08\xf5\x9aag\x00\x03README.md")
94
95 def testDownloadAssetStream(self):
96 (_, _, chunks) = self.asset.download_asset()

Callers

nothing calls this directly

Calls 2

download_assetMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected