Mercurial > hgrepos > Python > apps > py-cutils
comparison tests/test_shasum.py @ 103:af8318191ed3
Some more tests
| author | Franz Glasner <f.glasner@feldmann-mg.com> |
|---|---|
| date | Fri, 29 Apr 2022 10:31:18 +0200 |
| parents | 83dd2506f8f8 |
| children | 7f797d71bd5e |
comparison
equal
deleted
inserted
replaced
| 102:83dd2506f8f8 | 103:af8318191ed3 |
|---|---|
| 57 shasum.shasum(opts) | 57 shasum.shasum(opts) |
| 58 self.assertTrue( | 58 self.assertTrue( |
| 59 destfile.getvalue().startswith( | 59 destfile.getvalue().startswith( |
| 60 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 *")) | 60 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 *")) |
| 61 | 61 |
| 62 def test_empty_with_name(self): | |
| 63 destfile = _memfile() | |
| 64 with ChangedDir(DATADIR): | |
| 65 opts = shasum.gen_opts(algorithm="SHA256", | |
| 66 dest=destfile, | |
| 67 files=["empty"]) | |
| 68 shasum.shasum(opts) | |
| 69 self.assertEqual( | |
| 70 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 *empty\n", | |
| 71 destfile.getvalue()) | |
| 72 | |
| 73 def test_empty_with_name_bsd(self): | |
| 74 destfile = _memfile() | |
| 75 with ChangedDir(DATADIR): | |
| 76 opts = shasum.gen_opts(algorithm="SHA512", | |
| 77 dest=destfile, | |
| 78 files=["empty"], | |
| 79 bsd=True) | |
| 80 shasum.shasum(opts) | |
| 81 self.assertEqual( | |
| 82 "SHA512 (empty) = cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e\n", | |
| 83 destfile.getvalue()) | |
| 84 | |
| 62 def test_empty_mmap(self): | 85 def test_empty_mmap(self): |
| 63 destfile = _memfile() | 86 destfile = _memfile() |
| 64 opts = shasum.gen_opts(algorithm="SHA256", | 87 opts = shasum.gen_opts(algorithm="SHA256", |
| 65 dest=destfile, | 88 dest=destfile, |
| 66 files=[os.path.join(DATADIR, "empty")], | 89 files=[os.path.join(DATADIR, "empty")], |
