diff options
author | Gregory P. Smith <greg@krypto.org> | 2022-06-21 21:31:25 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-21 21:31:25 (GMT) |
commit | 296e4efebbd1865153ed3be24887a2af3898a0c4 (patch) | |
tree | 8a9fc16d932023ce8eec314984d89a552d295630 /Lib/test | |
parent | 4abab6b603dd38bec1168e9a37c40a48ec89508e (diff) | |
download | cpython-296e4efebbd1865153ed3be24887a2af3898a0c4.zip cpython-296e4efebbd1865153ed3be24887a2af3898a0c4.tar.gz cpython-296e4efebbd1865153ed3be24887a2af3898a0c4.tar.bz2 |
gh-89336: Remove configparser APIs that were deprecated for 3.12 (#92503)
https://github.com/python/cpython/issue/89336: Remove configparser 3.12 deprecations.
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_configparser.py | 42 |
1 files changed, 5 insertions, 37 deletions
diff --git a/Lib/test/test_configparser.py b/Lib/test/test_configparser.py index 59c4b27..5e2715a 100644 --- a/Lib/test/test_configparser.py +++ b/Lib/test/test_configparser.py @@ -1612,23 +1612,12 @@ class CoverageOneHundredTestCase(unittest.TestCase): self.assertEqual(error.section, 'section') def test_parsing_error(self): - with self.assertRaises(ValueError) as cm: + with self.assertRaises(TypeError) as cm: configparser.ParsingError() - self.assertEqual(str(cm.exception), "Required argument `source' not " - "given.") - with self.assertRaises(ValueError) as cm: - configparser.ParsingError(source='source', filename='filename') - self.assertEqual(str(cm.exception), "Cannot specify both `filename' " - "and `source'. Use `source'.") - error = configparser.ParsingError(filename='source') + error = configparser.ParsingError(source='source') + self.assertEqual(error.source, 'source') + error = configparser.ParsingError('source') self.assertEqual(error.source, 'source') - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter("always", DeprecationWarning) - self.assertEqual(error.filename, 'source') - error.filename = 'filename' - self.assertEqual(error.source, 'filename') - for warning in w: - self.assertTrue(warning.category is DeprecationWarning) def test_interpolation_validation(self): parser = configparser.ConfigParser() @@ -1647,27 +1636,6 @@ class CoverageOneHundredTestCase(unittest.TestCase): self.assertEqual(str(cm.exception), "bad interpolation variable " "reference '%(()'") - def test_readfp_deprecation(self): - sio = io.StringIO(""" - [section] - option = value - """) - parser = configparser.ConfigParser() - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter("always", DeprecationWarning) - parser.readfp(sio, filename='StringIO') - for warning in w: - self.assertTrue(warning.category is DeprecationWarning) - self.assertEqual(len(parser), 2) - self.assertEqual(parser['section']['option'], 'value') - - def test_safeconfigparser_deprecation(self): - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter("always", DeprecationWarning) - parser = configparser.SafeConfigParser() - for warning in w: - self.assertTrue(warning.category is DeprecationWarning) - def test_legacyinterpolation_deprecation(self): with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always", DeprecationWarning) @@ -1841,7 +1809,7 @@ class ExceptionPicklingTestCase(unittest.TestCase): self.assertEqual(e1.source, e2.source) self.assertEqual(e1.errors, e2.errors) self.assertEqual(repr(e1), repr(e2)) - e1 = configparser.ParsingError(filename='filename') + e1 = configparser.ParsingError('filename') e1.append(1, 'line1') e1.append(2, 'line2') e1.append(3, 'line3') |