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

Commit0e5358a

Browse files
authored
Merge pull request#1555 from Codym48/fix/get_values
Fix get_values() so it correctly loads section names
2 parents202e31c +fc843d3 commit0e5358a

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

‎git/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,7 @@ def get_values(
796796
:raise TypeError: in case the value could not be understood
797797
Otherwise the exceptions known to the ConfigParser will be raised."""
798798
try:
799+
self.sections()
799800
lst=self._sections[section].getall(option)
800801
exceptException:
801802
ifdefaultisnotNone:

‎test/test_config.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,17 @@ def test_empty_config_value(self):
398398
withself.assertRaises(cp.NoOptionError):
399399
cr.get_value("color","ui")
400400

401+
deftest_get_values_works_without_requiring_any_other_calls_first(self):
402+
file_obj=self._to_memcache(fixture_path("git_config_multiple"))
403+
cr=GitConfigParser(file_obj,read_only=True)
404+
self.assertEqual(cr.get_values("section0","option0"), ["value0"])
405+
file_obj.seek(0)
406+
cr=GitConfigParser(file_obj,read_only=True)
407+
self.assertEqual(cr.get_values("section1","option1"), ["value1a","value1b"])
408+
file_obj.seek(0)
409+
cr=GitConfigParser(file_obj,read_only=True)
410+
self.assertEqual(cr.get_values("section1","other_option1"), ["other_value1"])
411+
401412
deftest_multiple_values(self):
402413
file_obj=self._to_memcache(fixture_path("git_config_multiple"))
403414
withGitConfigParser(file_obj,read_only=False)ascw:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp