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_config.py | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'git/test/test_config.py') diff --git a/git/test/test_config.py b/git/test/test_config.py index b397b193..3884e877 100644 --- a/git/test/test_config.py +++ b/git/test/test_config.py @@ -11,16 +11,16 @@ from copy import copy from ConfigParser import NoSectionError class TestBase(TestCase): - + def _to_memcache(self, file_path): fp = open(file_path, "r") sio = StringIO.StringIO(fp.read()) sio.name = file_path return sio - + def _parsers_equal_or_raise(self, lhs, rhs): pass - + def test_read_write(self): # writer must create the exact same file as the one read before for filename in ("git_config", "git_config_global"): @@ -30,16 +30,16 @@ class TestBase(TestCase): w_config.read() # enforce reading assert w_config._sections w_config.write() # enforce writing - + # we stripped lines when reading, so the results differ assert file_obj.getvalue() != file_obj_orig.getvalue() - + # creating an additional config writer must fail due to exclusive access self.failUnlessRaises(IOError, GitConfigParser, file_obj, read_only = False) - + # should still have a lock and be able to make changes assert w_config._lock._has_lock() - + # changes should be written right away sname = "my_section" oname = "mykey" @@ -49,13 +49,13 @@ class TestBase(TestCase): w_config.set(sname, oname, val) assert w_config.has_option(sname,oname) assert w_config.get(sname, oname) == val - + sname_new = "new_section" oname_new = "new_key" ival = 10 w_config.set_value(sname_new, oname_new, ival) assert w_config.get_value(sname_new, oname_new) == ival - + file_obj.seek(0) r_config = GitConfigParser(file_obj, read_only=True) #print file_obj.getvalue() @@ -63,7 +63,7 @@ class TestBase(TestCase): assert r_config.has_option(sname, oname) assert r_config.get(sname, oname) == val # END for each filename - + def test_base(self): path_repo = fixture_path("git_config") path_global = fixture_path("git_config_global") @@ -71,7 +71,7 @@ class TestBase(TestCase): assert r_config.read_only num_sections = 0 num_options = 0 - + # test reader methods assert r_config._is_initialized == False for section in r_config.sections(): @@ -84,7 +84,7 @@ class TestBase(TestCase): assert val assert "\n" not in option assert "\n" not in val - + # writing must fail self.failUnlessRaises(IOError, r_config.set, section, option, None) self.failUnlessRaises(IOError, r_config.remove_option, section, option ) @@ -93,12 +93,10 @@ class TestBase(TestCase): # END for each section assert num_sections and num_options assert r_config._is_initialized == True - + # get value which doesnt exist, with default default = "my default value" assert r_config.get_value("doesnt", "exist", default) == default - + # it raises if there is no default though self.failUnlessRaises(NoSectionError, r_config.get_value, "doesnt", "exist") - - -- 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_config.py | 1 + 1 file changed, 1 insertion(+) (limited to 'git/test/test_config.py') diff --git a/git/test/test_config.py b/git/test/test_config.py index 3884e877..cd1c43ed 100644 --- a/git/test/test_config.py +++ b/git/test/test_config.py @@ -10,6 +10,7 @@ import StringIO from copy import copy from ConfigParser import NoSectionError + class TestBase(TestCase): def _to_memcache(self, file_path): -- 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_config.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'git/test/test_config.py') diff --git a/git/test/test_config.py b/git/test/test_config.py index cd1c43ed..de4727e0 100644 --- a/git/test/test_config.py +++ b/git/test/test_config.py @@ -27,7 +27,7 @@ class TestBase(TestCase): for filename in ("git_config", "git_config_global"): file_obj = self._to_memcache(fixture_path(filename)) file_obj_orig = copy(file_obj) - w_config = GitConfigParser(file_obj, read_only = False) + w_config = GitConfigParser(file_obj, read_only=False) w_config.read() # enforce reading assert w_config._sections w_config.write() # enforce writing @@ -36,7 +36,7 @@ class TestBase(TestCase): assert file_obj.getvalue() != file_obj_orig.getvalue() # creating an additional config writer must fail due to exclusive access - self.failUnlessRaises(IOError, GitConfigParser, file_obj, read_only = False) + self.failUnlessRaises(IOError, GitConfigParser, file_obj, read_only=False) # should still have a lock and be able to make changes assert w_config._lock._has_lock() @@ -48,7 +48,7 @@ class TestBase(TestCase): w_config.add_section(sname) assert w_config.has_section(sname) w_config.set(sname, oname, val) - assert w_config.has_option(sname,oname) + assert w_config.has_option(sname, oname) assert w_config.get(sname, oname) == val sname_new = "new_section" @@ -88,7 +88,7 @@ class TestBase(TestCase): # writing must fail self.failUnlessRaises(IOError, r_config.set, section, option, None) - self.failUnlessRaises(IOError, r_config.remove_option, section, option ) + self.failUnlessRaises(IOError, r_config.remove_option, section, option) # END for each option self.failUnlessRaises(IOError, r_config.remove_section, section) # END for each section -- 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_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git/test/test_config.py') diff --git a/git/test/test_config.py b/git/test/test_config.py index de4727e0..b6888023 100644 --- a/git/test/test_config.py +++ b/git/test/test_config.py @@ -91,7 +91,7 @@ class TestBase(TestCase): self.failUnlessRaises(IOError, r_config.remove_option, section, option) # END for each option self.failUnlessRaises(IOError, r_config.remove_section, section) - # END for each section + # END for each section assert num_sections and num_options assert r_config._is_initialized == True -- cgit v1.2.3