From f5d11b750ecc982541d1f936488248f0b42d75d3 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Sun, 16 Nov 2014 20:15:50 +0100 Subject: pep8 linting (whitespaces) W191 indentation contains tabs E221 multiple spaces before operator E222 multiple spaces after operator E225 missing whitespace around operator E271 multiple spaces after keyword W292 no newline at end of file W293 blank line contains whitespace W391 blank line at end of file --- git/test/test_reflog.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'git/test/test_reflog.py') diff --git a/git/test/test_reflog.py b/git/test/test_reflog.py index fca9e1cd..ba3a531b 100644 --- a/git/test/test_reflog.py +++ b/git/test/test_reflog.py @@ -14,49 +14,49 @@ class TestRefLog(TestBase): hexsha = 'F' * 40 actor = Actor('name', 'email') msg = "message" - + self.failUnlessRaises(ValueError, RefLogEntry.new, nullhexsha, hexsha, 'noactor', 0, 0, "") e = RefLogEntry.new(nullhexsha, hexsha, actor, 0, 1, msg) - + assert e.oldhexsha == nullhexsha assert e.newhexsha == hexsha assert e.actor == actor assert e.time[0] == 0 assert e.time[1] == 1 assert e.message == msg - + # check representation (roughly) assert repr(e).startswith(nullhexsha) - + def test_base(self): rlp_head = fixture_path('reflog_HEAD') rlp_master = fixture_path('reflog_master') tdir = tempfile.mktemp(suffix="test_reflogs") os.mkdir(tdir) - + rlp_master_ro = RefLog.path(self.rorepo.head) assert os.path.isfile(rlp_master_ro) - + # simple read reflog = RefLog.from_file(rlp_master_ro) assert reflog._path is not None assert isinstance(reflog, RefLog) assert len(reflog) - + # iter_entries works with path and with stream assert len(list(RefLog.iter_entries(open(rlp_master)))) 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'): self.failUnlessRaises(ValueError, RefLog.from_file, fixture_path(pp+suffix)) #END for each invalid file - + # cannot write an uninitialized reflog self.failUnlessRaises(ValueError, RefLog().write) - + # test serialize and deserialize - results must match exactly binsha = chr(255)*20 msg = "my reflog message" @@ -66,35 +66,35 @@ class TestRefLog(TestBase): tfile = os.path.join(tdir, os.path.basename(rlp)) reflog.to_file(tfile) assert reflog.write() is reflog - + # parsed result must match ... treflog = RefLog.from_file(tfile) assert treflog == reflog - + # ... as well as each bytes of the written stream assert open(tfile).read() == open(rlp).read() - + # append an entry 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.message == msg assert RefLog.from_file(tfile)[-1] == entry - + # index entry # raises on invalid index self.failUnlessRaises(IndexError, RefLog.entry_at, rlp, 10000) - + # indices can be positive ... assert isinstance(RefLog.entry_at(rlp, 0), RefLogEntry) RefLog.entry_at(rlp, 23) - + # ... and negative for idx in (-1, -24): RefLog.entry_at(rlp, idx) #END for each index to read # END for each reflog - - + + # finally remove our temporary data shutil.rmtree(tdir) -- cgit v1.2.3 From be34ec23c48d6d5d8fd2ef4491981f6fb4bab8e6 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Sun, 16 Nov 2014 20:51:04 +0100 Subject: pep8 linting (blank lines expectations) E301 expected 1 blank line, found 0 E302 expected 2 blank lines, found 1 E303 too many blank lines (n) --- git/test/test_reflog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git/test/test_reflog.py') diff --git a/git/test/test_reflog.py b/git/test/test_reflog.py index ba3a531b..76cfd870 100644 --- a/git/test/test_reflog.py +++ b/git/test/test_reflog.py @@ -7,6 +7,7 @@ import tempfile import shutil import os + class TestRefLog(TestBase): def test_reflogentry(self): @@ -95,6 +96,5 @@ class TestRefLog(TestBase): #END for each index to read # END for each reflog - # finally remove our temporary data shutil.rmtree(tdir) -- cgit v1.2.3 From 614907b7445e2ed8584c1c37df7e466e3b56170f Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Sun, 16 Nov 2014 20:56:53 +0100 Subject: pep8 linting (whitespace before/after) E201 whitespace after '(' E202 whitespace before ')' E203 whitespace before ':' E225 missing whitespace around operator E226 missing whitespace around arithmetic operator E227 missing whitespace around bitwise or shift operator E228 missing whitespace around modulo operator E231 missing whitespace after ',' E241 multiple spaces after ',' E251 unexpected spaces around keyword / parameter equals --- git/test/test_reflog.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'git/test/test_reflog.py') diff --git a/git/test/test_reflog.py b/git/test/test_reflog.py index 76cfd870..a68b25a3 100644 --- a/git/test/test_reflog.py +++ b/git/test/test_reflog.py @@ -52,14 +52,14 @@ class TestRefLog(TestBase): # TODO: Try multiple corrupted ones ! pp = 'reflog_invalid_' for suffix in ('oldsha', 'newsha', 'email', 'date', 'sep'): - self.failUnlessRaises(ValueError, RefLog.from_file, fixture_path(pp+suffix)) + self.failUnlessRaises(ValueError, RefLog.from_file, fixture_path(pp + suffix)) #END for each invalid file # cannot write an uninitialized reflog self.failUnlessRaises(ValueError, RefLog().write) # test serialize and deserialize - results must match exactly - binsha = chr(255)*20 + binsha = chr(255) * 20 msg = "my reflog message" cr = self.rorepo.config_reader() for rlp in (rlp_head, rlp_master): @@ -78,7 +78,7 @@ class TestRefLog(TestBase): # append an entry 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 -- cgit v1.2.3 From c8e70749887370a99adeda972cc3503397b5f9a7 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Sun, 16 Nov 2014 21:09:47 +0100 Subject: pep8 linting (trailing whitespace) W291 trailing whitespace --- git/test/test_reflog.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'git/test/test_reflog.py') diff --git a/git/test/test_reflog.py b/git/test/test_reflog.py index a68b25a3..fec50095 100644 --- a/git/test/test_reflog.py +++ b/git/test/test_reflog.py @@ -35,7 +35,7 @@ class TestRefLog(TestBase): tdir = tempfile.mktemp(suffix="test_reflogs") os.mkdir(tdir) - rlp_master_ro = RefLog.path(self.rorepo.head) + rlp_master_ro = RefLog.path(self.rorepo.head) assert os.path.isfile(rlp_master_ro) # simple read @@ -94,7 +94,7 @@ class TestRefLog(TestBase): for idx in (-1, -24): RefLog.entry_at(rlp, idx) #END for each index to read - # END for each reflog + # END for each reflog # finally remove our temporary data shutil.rmtree(tdir) -- cgit v1.2.3