diff options
Diffstat (limited to 'test/git/test_base.py')
-rw-r--r-- | test/git/test_base.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/test/git/test_base.py b/test/git/test_base.py index 71576048..b93e61c1 100644 --- a/test/git/test_base.py +++ b/test/git/test_base.py @@ -4,12 +4,15 @@ # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php -from test.testlib import * -from git import * import git.objects.base as base import git.refs as refs +import os + +from test.testlib import * +from git import * from itertools import chain from git.objects.utils import get_object_type_by_name +import tempfile class TestBase(object): @@ -48,6 +51,17 @@ class TestBase(object): assert not item.path.startswith("/") # must be relative assert isinstance(item.mode, int) # END index object check + + # read from stream + data_stream = item.data_stream + data = data_stream.read() + assert data + + tmpfile = os.tmpfile() + assert item == item.stream_data(tmpfile) + tmpfile.seek(0) + assert tmpfile.read() == data + # END stream to file directly # END for each object type to create # each has a unique sha |