diff options
| author | Sebastian Thiel <byronimo@gmail.com> | 2014-11-13 18:46:49 +0100 |
|---|---|---|
| committer | Sebastian Thiel <byronimo@gmail.com> | 2014-11-13 18:46:49 +0100 |
| commit | 8ae4e9579a263684c6b760aec2869be480ff22ba (patch) | |
| tree | f0f3344ffb385a6d3202087a5cdebb7589792e37 /gitdb/test/db | |
| parent | 641b64c9f48139cf06774805d32892012fb9b82d (diff) | |
| download | gitdb-8ae4e9579a263684c6b760aec2869be480ff22ba.tar.gz | |
reduced usage of force_bytes as clients are expected to pass bytes.
It was useful for debugging though, maybe an explicit type assertions would
help others ?
As 'others' will be gitpython, I suppose I can handle it myself
Diffstat (limited to 'gitdb/test/db')
| -rw-r--r-- | gitdb/test/db/lib.py | 7 | ||||
| -rw-r--r-- | gitdb/test/db/test_ref.py | 8 |
2 files changed, 8 insertions, 7 deletions
diff --git a/gitdb/test/db/lib.py b/gitdb/test/db/lib.py index 962d4bc..af6d9e0 100644 --- a/gitdb/test/db/lib.py +++ b/gitdb/test/db/lib.py @@ -23,7 +23,6 @@ from gitdb.base import ( from gitdb.exc import BadObject from gitdb.typ import str_blob_type -from gitdb.utils.encoding import force_bytes from gitdb.utils.compat import xrange from io import BytesIO @@ -37,7 +36,7 @@ class TestDBBase(TestBase): """Base class providing testing routines on databases""" # data - two_lines = "1234\nhello world" + two_lines = b'1234\nhello world' all_data = (two_lines, ) def _assert_object_writing_simple(self, db): @@ -83,7 +82,7 @@ class TestDBBase(TestBase): prev_ostream = db.set_ostream(ostream) assert type(prev_ostream) in ostreams or prev_ostream in ostreams - istream = IStream(str_blob_type, len(data), BytesIO(data.encode("ascii"))) + istream = IStream(str_blob_type, len(data), BytesIO(data)) # store returns same istream instance, with new sha set my_istream = db.store(istream) @@ -99,7 +98,7 @@ class TestDBBase(TestBase): assert info.size == len(data) ostream = db.stream(sha) - assert ostream.read() == force_bytes(data) + assert ostream.read() == data assert ostream.type == str_blob_type assert ostream.size == len(data) else: diff --git a/gitdb/test/db/test_ref.py b/gitdb/test/db/test_ref.py index a1387ee..db93082 100644 --- a/gitdb/test/db/test_ref.py +++ b/gitdb/test/db/test_ref.py @@ -2,7 +2,11 @@ # # This module is part of GitDB and is released under # the New BSD License: http://www.opensource.org/licenses/bsd-license.php -from gitdb.test.db.lib import * +from gitdb.test.db.lib import ( + TestDBBase, + with_rw_directory, + fixture_path +) from gitdb.db import ReferenceDB from gitdb.util import ( @@ -24,8 +28,6 @@ class TestReferenceDB(TestDBBase): @with_rw_directory def test_writing(self, path): - NULL_BIN_SHA = '\0'.encode("ascii") * 20 - alt_path = os.path.join(path, 'alternates') rdb = ReferenceDB(alt_path) assert len(rdb.databases()) == 0 |
