Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite5a2db5

Browse files
committed
TestConfigParser with whitespace outside the value
In both the:- Unquoted case, where extra whitespace is at the edges of what can be parsed as the value.- Quoted case, where extra whitespace is next to but outside of the quotes.The case where the whitespace is at the edges of the quoted valueand *inside* the quotes, and thus part of the value, is alreadycovered in#2036. (That is merely renamed here, to distinguish it.)
1 parent2e0d835 commite5a2db5

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[init]
2+
defaultBranch = trunk
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[init]
2+
defaultBranch = "trunk"

‎test/test_config.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,10 @@ def test_complex_aliases(self):
398398
self._to_memcache(fixture_path(".gitconfig")).getvalue(),
399399
)
400400

401+
deftest_config_with_extra_whitespace(self):
402+
cr=GitConfigParser(fixture_path("git_config_with_extra_whitespace"),read_only=True)
403+
self.assertEqual(cr.get("init","defaultBranch"),"trunk")
404+
401405
deftest_empty_config_value(self):
402406
cr=GitConfigParser(fixture_path("git_config_with_empty_value"),read_only=True)
403407

@@ -413,9 +417,13 @@ def test_config_with_quotes(self):
413417
self.assertEqual(cr.get("user","email"),"cveal05@gmail.com")
414418

415419
deftest_config_with_quotes_with_literal_whitespace(self):
416-
cr=GitConfigParser(fixture_path("git_config_with_quotes_whitespace"),read_only=True)
420+
cr=GitConfigParser(fixture_path("git_config_with_quotes_whitespace_inside"),read_only=True)
417421
self.assertEqual(cr.get("core","commentString"),"# ")
418422

423+
deftest_config_with_quotes_with_whitespace_outside_value(self):
424+
cr=GitConfigParser(fixture_path("git_config_with_quotes_whitespace_outside"),read_only=True)
425+
self.assertEqual(cr.get("init","defaultBranch"),"trunk")
426+
419427
deftest_get_values_works_without_requiring_any_other_calls_first(self):
420428
file_obj=self._to_memcache(fixture_path("git_config_multiple"))
421429
cr=GitConfigParser(file_obj,read_only=True)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp