diff options
| author | Sebastian Thiel <byronimo@gmail.com> | 2015-01-01 14:00:34 +0100 |
|---|---|---|
| committer | Sebastian Thiel <byronimo@gmail.com> | 2015-01-01 14:00:34 +0100 |
| commit | 6b32bbcc0b9ca142fc3b066fcd0d76e2a731423d (patch) | |
| tree | 7676d76fdf1346d610c6cf9e9d45b3d27c2d482d /gitdb/test | |
| parent | c38bd19706abe5cf0bf0e7b3e9ad2b3e554d28ef (diff) | |
| download | gitdb-6b32bbcc0b9ca142fc3b066fcd0d76e2a731423d.tar.gz | |
Slightly improved loose object decompression test
Diffstat (limited to 'gitdb/test')
| -rw-r--r-- | gitdb/test/test_stream.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gitdb/test/test_stream.py b/gitdb/test/test_stream.py index eab9a19..aa434ad 100644 --- a/gitdb/test/test_stream.py +++ b/gitdb/test/test_stream.py @@ -16,7 +16,9 @@ from gitdb import ( DecompressMemMapReader, FDCompressedSha1Writer, LooseObjectDB, - Sha1Writer + Sha1Writer, + MemoryDB, + IStream, ) from gitdb.util import hex_to_bin @@ -27,6 +29,7 @@ from gitdb.typ import ( import tempfile import os +from io import BytesIO class TestStream(TestBase): """Test stream classes""" @@ -144,6 +147,7 @@ class TestStream(TestBase): def test_decompress_reader_special_case(self): odb = LooseObjectDB(fixture_path('objects')) + mdb = MemoryDB() for sha in ('888401851f15db0eed60eb1bc29dec5ddcace911', '7bb839852ed5e3a069966281bb08d50012fb309b',): ostream = odb.stream(hex_to_bin(sha)) @@ -151,4 +155,8 @@ class TestStream(TestBase): # if there is a bug, we will be missing one byte exactly ! data = ostream.read() assert len(data) == ostream.size + + # Putting it back in should yield nothing new - after all, we have + dump = mdb.store(IStream(ostream.type, ostream.size, BytesIO(data))) + assert dump.hexsha == sha # end for each loose object sha to test |
