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

Fix get_values() so it correctly loads section names#1555

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Byron merged 2 commits intogitpython-developers:mainfromCodym48:fix/get_values
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletionsgit/config.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -796,6 +796,7 @@ def get_values(
:raise TypeError: in case the value could not be understood
Otherwise the exceptions known to the ConfigParser will be raised."""
try:
self.sections()
lst = self._sections[section].getall(option)
except Exception:
if default is not None:
Expand Down
11 changes: 11 additions & 0 deletionstest/test_config.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -398,6 +398,17 @@ def test_empty_config_value(self):
with self.assertRaises(cp.NoOptionError):
cr.get_value("color", "ui")

def test_get_values_works_without_requiring_any_other_calls_first(self):
file_obj = self._to_memcache(fixture_path("git_config_multiple"))
cr = GitConfigParser(file_obj, read_only=True)
self.assertEqual(cr.get_values("section0", "option0"), ["value0"])
file_obj.seek(0)
cr = GitConfigParser(file_obj, read_only=True)
self.assertEqual(cr.get_values("section1", "option1"), ["value1a", "value1b"])
file_obj.seek(0)
cr = GitConfigParser(file_obj, read_only=True)
self.assertEqual(cr.get_values("section1", "other_option1"), ["other_value1"])

def test_multiple_values(self):
file_obj = self._to_memcache(fixture_path("git_config_multiple"))
with GitConfigParser(file_obj, read_only=False) as cw:
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp