Skip to content

Commit ca0d4f7

Browse files
committed
test_configparser: allow newconfig to accept **kwargs to support custom options
Signed-off-by: sundeep8967 <sundeep8967@gmail.com>
1 parent 97bf5cb commit ca0d4f7

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

Lib/test/test_configparser.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class CfgParserTestCaseClass:
4343
default_section = configparser.DEFAULTSECT
4444
interpolation = configparser._UNSET
4545

46-
def newconfig(self, defaults=None):
46+
def newconfig(self, defaults=None, **kwargs):
4747
arguments = dict(
4848
defaults=defaults,
4949
allow_no_value=self.allow_no_value,
@@ -56,6 +56,7 @@ def newconfig(self, defaults=None):
5656
default_section=self.default_section,
5757
interpolation=self.interpolation,
5858
)
59+
arguments.update(kwargs)
5960
instance = self.config_class(**arguments)
6061
return instance
6162

@@ -1998,8 +1999,8 @@ class ConvertersTestCase(BasicTestCase, unittest.TestCase):
19981999

19992000
config_class = configparser.ConfigParser
20002001

2001-
def newconfig(self, defaults=None):
2002-
instance = super().newconfig(defaults=defaults)
2002+
def newconfig(self, defaults=None, **kwargs):
2003+
instance = super().newconfig(defaults=defaults, **kwargs)
20032004
instance.converters['list'] = lambda v: [e.strip() for e in v.split()
20042005
if e.strip()]
20052006
return instance

0 commit comments

Comments
 (0)