mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Renamed ConfigParser to configparser.
Merged revisions 63247-63248 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r63247 | georg.brandl | 2008-05-14 18:30:31 -0400 (Wed, 14 May 2008) | 2 lines Update configparser docs for lowercasing rename. ........ r63248 | alexandre.vassalotti | 2008-05-14 18:44:22 -0400 (Wed, 14 May 2008) | 8 lines Updated import statements to use the new `configparser` module name. Updated the documentation to use the new name. Revert addition of the stub entry for the old name. Georg, I am reverting your changes since this commit should propagate to py3k. ........
This commit is contained in:
parent
84726faf41
commit
1d1eaa45c9
11 changed files with 61 additions and 58 deletions
|
@ -1,4 +1,4 @@
|
|||
import ConfigParser
|
||||
import configparser
|
||||
import io
|
||||
import unittest
|
||||
import collections
|
||||
|
@ -89,7 +89,7 @@ class TestCaseBase(unittest.TestCase):
|
|||
"remove_option() failed to report non-existance of option"
|
||||
" that was removed")
|
||||
|
||||
self.assertRaises(ConfigParser.NoSectionError,
|
||||
self.assertRaises(configparser.NoSectionError,
|
||||
cf.remove_option, 'No Such Section', 'foo')
|
||||
|
||||
eq(cf.get('Long Line', 'foo'),
|
||||
|
@ -142,17 +142,17 @@ class TestCaseBase(unittest.TestCase):
|
|||
|
||||
def test_parse_errors(self):
|
||||
self.newconfig()
|
||||
self.parse_error(ConfigParser.ParsingError,
|
||||
self.parse_error(configparser.ParsingError,
|
||||
"[Foo]\n extra-spaces: splat\n")
|
||||
self.parse_error(ConfigParser.ParsingError,
|
||||
self.parse_error(configparser.ParsingError,
|
||||
"[Foo]\n extra-spaces= splat\n")
|
||||
self.parse_error(ConfigParser.ParsingError,
|
||||
self.parse_error(configparser.ParsingError,
|
||||
"[Foo]\noption-without-value\n")
|
||||
self.parse_error(ConfigParser.ParsingError,
|
||||
self.parse_error(configparser.ParsingError,
|
||||
"[Foo]\n:value-without-option-name\n")
|
||||
self.parse_error(ConfigParser.ParsingError,
|
||||
self.parse_error(configparser.ParsingError,
|
||||
"[Foo]\n=value-without-option-name\n")
|
||||
self.parse_error(ConfigParser.MissingSectionHeaderError,
|
||||
self.parse_error(configparser.MissingSectionHeaderError,
|
||||
"No Section!\n")
|
||||
|
||||
def parse_error(self, exc, src):
|
||||
|
@ -165,13 +165,13 @@ class TestCaseBase(unittest.TestCase):
|
|||
"new ConfigParser should have no defined sections")
|
||||
self.failIf(cf.has_section("Foo"),
|
||||
"new ConfigParser should have no acknowledged sections")
|
||||
self.assertRaises(ConfigParser.NoSectionError,
|
||||
self.assertRaises(configparser.NoSectionError,
|
||||
cf.options, "Foo")
|
||||
self.assertRaises(ConfigParser.NoSectionError,
|
||||
self.assertRaises(configparser.NoSectionError,
|
||||
cf.set, "foo", "bar", "value")
|
||||
self.get_error(ConfigParser.NoSectionError, "foo", "bar")
|
||||
self.get_error(configparser.NoSectionError, "foo", "bar")
|
||||
cf.add_section("foo")
|
||||
self.get_error(ConfigParser.NoOptionError, "foo", "bar")
|
||||
self.get_error(configparser.NoOptionError, "foo", "bar")
|
||||
|
||||
def get_error(self, exc, section, option):
|
||||
try:
|
||||
|
@ -210,7 +210,7 @@ class TestCaseBase(unittest.TestCase):
|
|||
def test_weird_errors(self):
|
||||
cf = self.newconfig()
|
||||
cf.add_section("Foo")
|
||||
self.assertRaises(ConfigParser.DuplicateSectionError,
|
||||
self.assertRaises(configparser.DuplicateSectionError,
|
||||
cf.add_section, "Foo")
|
||||
|
||||
def test_write(self):
|
||||
|
@ -314,7 +314,7 @@ class TestCaseBase(unittest.TestCase):
|
|||
|
||||
|
||||
class ConfigParserTestCase(TestCaseBase):
|
||||
config_class = ConfigParser.ConfigParser
|
||||
config_class = configparser.ConfigParser
|
||||
|
||||
def test_interpolation(self):
|
||||
cf = self.get_interpolation_config()
|
||||
|
@ -325,11 +325,11 @@ class ConfigParserTestCase(TestCaseBase):
|
|||
"something with lots of interpolation (9 steps)")
|
||||
eq(cf.get("Foo", "bar10"),
|
||||
"something with lots of interpolation (10 steps)")
|
||||
self.get_error(ConfigParser.InterpolationDepthError, "Foo", "bar11")
|
||||
self.get_error(configparser.InterpolationDepthError, "Foo", "bar11")
|
||||
|
||||
def test_interpolation_missing_value(self):
|
||||
cf = self.get_interpolation_config()
|
||||
e = self.get_error(ConfigParser.InterpolationError,
|
||||
e = self.get_error(configparser.InterpolationError,
|
||||
"Interpolation Error", "name")
|
||||
self.assertEqual(e.reference, "reference")
|
||||
self.assertEqual(e.section, "Interpolation Error")
|
||||
|
@ -365,7 +365,7 @@ class ConfigParserTestCase(TestCaseBase):
|
|||
|
||||
|
||||
class RawConfigParserTestCase(TestCaseBase):
|
||||
config_class = ConfigParser.RawConfigParser
|
||||
config_class = configparser.RawConfigParser
|
||||
|
||||
def test_interpolation(self):
|
||||
cf = self.get_interpolation_config()
|
||||
|
@ -400,7 +400,7 @@ class RawConfigParserTestCase(TestCaseBase):
|
|||
|
||||
|
||||
class SafeConfigParserTestCase(ConfigParserTestCase):
|
||||
config_class = ConfigParser.SafeConfigParser
|
||||
config_class = configparser.SafeConfigParser
|
||||
|
||||
def test_safe_interpolation(self):
|
||||
# See http://www.python.org/sf/511737
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue