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_diff.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'git/test/test_diff.py') diff --git a/git/test/test_diff.py b/git/test/test_diff.py index 80652c8e..a59ee0bf 100644 --- a/git/test/test_diff.py +++ b/git/test/test_diff.py @@ -8,7 +8,7 @@ from git.test.lib import * from git import * class TestDiff(TestBase): - + def _assert_diff_format(self, diffs): # verify that the format of the diff is sane for diff in diffs: @@ -16,19 +16,19 @@ class TestDiff(TestBase): assert isinstance(diff.a_mode, int) if diff.b_mode: assert isinstance(diff.b_mode, int) - + if diff.a_blob: assert not diff.a_blob.path.endswith('\n') if diff.b_blob: assert not diff.b_blob.path.endswith('\n') # END for each diff return diffs - + def test_list_from_string_new_mode(self): output = StringProcessAdapter(fixture('diff_new_mode')) diffs = Diff._index_from_patch_format(self.rorepo, output.stdout) self._assert_diff_format(diffs) - + assert_equal(1, len(diffs)) assert_equal(10, len(diffs[0].diff.splitlines())) @@ -36,7 +36,7 @@ class TestDiff(TestBase): output = StringProcessAdapter(fixture('diff_rename')) diffs = Diff._index_from_patch_format(self.rorepo, output.stdout) self._assert_diff_format(diffs) - + assert_equal(1, len(diffs)) diff = diffs[0] @@ -50,7 +50,7 @@ class TestDiff(TestBase): fixtures = ("diff_2", "diff_2f", "diff_f", "diff_i", "diff_mode_only", "diff_new_mode", "diff_numstat", "diff_p", "diff_rename", "diff_tree_numstat_root" ) - + for fixture_name in fixtures: diff_proc = StringProcessAdapter(fixture(fixture_name)) diffs = Diff._index_from_patch_format(self.rorepo, diff_proc.stdout) @@ -64,13 +64,13 @@ class TestDiff(TestBase): if i%2 == 0: diff_item = commit.tree # END use tree every second item - + for other in (None, commit.Index, commit.parents[0]): for paths in (None, "CHANGES", ("CHANGES", "lib")): for create_patch in range(2): diff_index = diff_item.diff(other, paths, create_patch) assert isinstance(diff_index, DiffIndex) - + if diff_index: self._assert_diff_format(diff_index) for ct in DiffIndex.change_type: @@ -78,7 +78,7 @@ class TestDiff(TestBase): assertion_map.setdefault(key, 0) assertion_map[key] = assertion_map[key]+len(list(diff_index.iter_change_type(ct))) # END for each changetype - + # check entries diff_set = set() diff_set.add(diff_index[0]) @@ -91,18 +91,16 @@ class TestDiff(TestBase): # END for each path option # END for each other side # END for each commit - + # assert we could always find at least one instance of the members we # can iterate in the diff index - if not this indicates its not working correctly # or our test does not span the whole range of possibilities for key,value in assertion_map.items(): assert value, "Did not find diff for %s" % key # END for each iteration type - + # test path not existing in the index - should be ignored c = self.rorepo.head.commit cp = c.parents[0] diff_index = c.diff(cp, ["does/not/exist"]) assert len(diff_index) == 0 - - -- cgit v1.2.1 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_diff.py | 1 + 1 file changed, 1 insertion(+) (limited to 'git/test/test_diff.py') diff --git a/git/test/test_diff.py b/git/test/test_diff.py index a59ee0bf..3c2537da 100644 --- a/git/test/test_diff.py +++ b/git/test/test_diff.py @@ -7,6 +7,7 @@ from git.test.lib import * from git import * + class TestDiff(TestBase): def _assert_diff_format(self, diffs): -- cgit v1.2.1 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_diff.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'git/test/test_diff.py') diff --git a/git/test/test_diff.py b/git/test/test_diff.py index 3c2537da..aacd9368 100644 --- a/git/test/test_diff.py +++ b/git/test/test_diff.py @@ -50,7 +50,7 @@ class TestDiff(TestBase): # be able to deal with it fixtures = ("diff_2", "diff_2f", "diff_f", "diff_i", "diff_mode_only", "diff_new_mode", "diff_numstat", "diff_p", "diff_rename", - "diff_tree_numstat_root" ) + "diff_tree_numstat_root") for fixture_name in fixtures: diff_proc = StringProcessAdapter(fixture(fixture_name)) @@ -62,7 +62,7 @@ class TestDiff(TestBase): assertion_map = dict() for i, commit in enumerate(self.rorepo.iter_commits('0.1.6', max_count=2)): diff_item = commit - if i%2 == 0: + if i % 2 == 0: diff_item = commit.tree # END use tree every second item @@ -75,9 +75,9 @@ class TestDiff(TestBase): if diff_index: self._assert_diff_format(diff_index) for ct in DiffIndex.change_type: - key = 'ct_%s'%ct + key = 'ct_%s' % ct assertion_map.setdefault(key, 0) - assertion_map[key] = assertion_map[key]+len(list(diff_index.iter_change_type(ct))) + assertion_map[key] = assertion_map[key] + len(list(diff_index.iter_change_type(ct))) # END for each changetype # check entries @@ -96,7 +96,7 @@ class TestDiff(TestBase): # assert we could always find at least one instance of the members we # can iterate in the diff index - if not this indicates its not working correctly # or our test does not span the whole range of possibilities - for key,value in assertion_map.items(): + for key, value in assertion_map.items(): assert value, "Did not find diff for %s" % key # END for each iteration type -- cgit v1.2.1 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_diff.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'git/test/test_diff.py') diff --git a/git/test/test_diff.py b/git/test/test_diff.py index aacd9368..151a3d14 100644 --- a/git/test/test_diff.py +++ b/git/test/test_diff.py @@ -48,8 +48,8 @@ class TestDiff(TestBase): def test_diff_patch_format(self): # test all of the 'old' format diffs for completness - it should at least # be able to deal with it - fixtures = ("diff_2", "diff_2f", "diff_f", "diff_i", "diff_mode_only", - "diff_new_mode", "diff_numstat", "diff_p", "diff_rename", + fixtures = ("diff_2", "diff_2f", "diff_f", "diff_i", "diff_mode_only", + "diff_new_mode", "diff_numstat", "diff_p", "diff_rename", "diff_tree_numstat_root") for fixture_name in fixtures: @@ -77,7 +77,7 @@ class TestDiff(TestBase): for ct in DiffIndex.change_type: key = 'ct_%s' % ct assertion_map.setdefault(key, 0) - assertion_map[key] = assertion_map[key] + len(list(diff_index.iter_change_type(ct))) + assertion_map[key] = assertion_map[key] + len(list(diff_index.iter_change_type(ct))) # END for each changetype # check entries @@ -87,18 +87,18 @@ class TestDiff(TestBase): assert len(diff_set) == 1 assert diff_index[0] == diff_index[0] assert not (diff_index[0] != diff_index[0]) - # END diff index checking + # END diff index checking # END for each patch option # END for each path option # END for each other side # END for each commit - # assert we could always find at least one instance of the members we + # assert we could always find at least one instance of the members we # can iterate in the diff index - if not this indicates its not working correctly # or our test does not span the whole range of possibilities for key, value in assertion_map.items(): assert value, "Did not find diff for %s" % key - # END for each iteration type + # END for each iteration type # test path not existing in the index - should be ignored c = self.rorepo.head.commit -- cgit v1.2.1