diff options
author | Sebastian Thiel <sebastian.thiel@icloud.com> | 2022-05-18 07:43:53 +0800 |
---|---|---|
committer | Sebastian Thiel <sebastian.thiel@icloud.com> | 2022-05-18 07:43:53 +0800 |
commit | 21ec529987d10e0010badd37f8da3274167d436f (patch) | |
tree | a3394cfe902ce7edd07c89420c21c13274a2d295 /test/test_reflog.py | |
parent | b30720ee4d9762a03eae4fa7cfa4b0190d81784d (diff) | |
download | gitpython-21ec529987d10e0010badd37f8da3274167d436f.tar.gz |
Run everything through 'black'
That way people who use it won't be deterred, while it unifies style
everywhere.
Diffstat (limited to 'test/test_reflog.py')
-rw-r--r-- | test/test_reflog.py | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/test/test_reflog.py b/test/test_reflog.py index a6c15950..c126d3dc 100644 --- a/test/test_reflog.py +++ b/test/test_reflog.py @@ -2,28 +2,23 @@ import os import tempfile from git.objects import IndexObject -from git.refs import ( - RefLogEntry, - RefLog -) -from test.lib import ( - TestBase, - fixture_path -) +from git.refs import RefLogEntry, RefLog +from test.lib import TestBase, fixture_path from git.util import Actor, rmtree, hex_to_bin import os.path as osp class TestRefLog(TestBase): - def test_reflogentry(self): nullhexsha = IndexObject.NULL_HEX_SHA - hexsha = 'F' * 40 - actor = Actor('name', 'email') + hexsha = "F" * 40 + actor = Actor("name", "email") msg = "message" - self.assertRaises(ValueError, RefLogEntry.new, nullhexsha, hexsha, 'noactor', 0, 0, "") + self.assertRaises( + ValueError, RefLogEntry.new, nullhexsha, hexsha, "noactor", 0, 0, "" + ) e = RefLogEntry.new(nullhexsha, hexsha, actor, 0, 1, msg) assert e.oldhexsha == nullhexsha @@ -37,8 +32,8 @@ class TestRefLog(TestBase): assert repr(e).startswith(nullhexsha) def test_base(self): - rlp_head = fixture_path('reflog_HEAD') - rlp_master = fixture_path('reflog_master') + rlp_head = fixture_path("reflog_HEAD") + rlp_master = fixture_path("reflog_master") tdir = tempfile.mktemp(suffix="test_reflogs") os.mkdir(tdir) @@ -52,13 +47,13 @@ class TestRefLog(TestBase): assert len(reflog) # iter_entries works with path and with stream - assert len(list(RefLog.iter_entries(open(rlp_master, 'rb')))) + assert len(list(RefLog.iter_entries(open(rlp_master, "rb")))) assert len(list(RefLog.iter_entries(rlp_master))) # raise on invalid revlog # TODO: Try multiple corrupted ones ! - pp = 'reflog_invalid_' - for suffix in ('oldsha', 'newsha', 'email', 'date', 'sep'): + pp = "reflog_invalid_" + for suffix in ("oldsha", "newsha", "email", "date", "sep"): self.assertRaises(ValueError, RefLog.from_file, fixture_path(pp + suffix)) # END for each invalid file @@ -66,7 +61,7 @@ class TestRefLog(TestBase): self.assertRaises(ValueError, RefLog().write) # test serialize and deserialize - results must match exactly - binsha = hex_to_bin(('f' * 40).encode('ascii')) + binsha = hex_to_bin(("f" * 40).encode("ascii")) msg = "my reflog message" cr = self.rorepo.config_reader() for rlp in (rlp_head, rlp_master): @@ -83,9 +78,11 @@ class TestRefLog(TestBase): assert open(tfile).read() == open(rlp).read() # append an entry - entry = RefLog.append_entry(cr, tfile, IndexObject.NULL_BIN_SHA, binsha, msg) + entry = RefLog.append_entry( + cr, tfile, IndexObject.NULL_BIN_SHA, binsha, msg + ) assert entry.oldhexsha == IndexObject.NULL_HEX_SHA - assert entry.newhexsha == 'f' * 40 + assert entry.newhexsha == "f" * 40 assert entry.message == msg assert RefLog.from_file(tfile)[-1] == entry |