8000 optionfile: Replace `_` with `-` (#1114) · PyMySQL/PyMySQL@9228700 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9228700

Browse files
authored
10000
optionfile: Replace _ with - (#1114)
Fix #1020
1 parent b39a43a commit 9228700

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

pymysql/optionfile.py

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ def __remove_quotes(self, value):
1313
return value[1:-1]
1414
return value
1515

16+
def optionxform(self, key):
17+
return key.lower().replace("_", "-")
18+
1619
def get(self, section, option):
1720
value = configparser.RawConfigParser.get(self, section, option)
1821
return self.__remove_quotes(value)

pymysql/tests/test_optionfile.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ def test_string(self):
2121
parser.read_file(StringIO(_cfg_file))
2222
self.assertEqual(parser.get("default", "string"), "foo")
2323
self.assertEqual(parser.get("default", "quoted"), "bar")
24-
self.assertEqual(parser.get("default", "single_quoted"), "foo 3BE2 bar")
24+
self.assertEqual(parser.get("default", "single-quoted"), "foobar")

0 commit comments

Comments
 (0)
0