ConfigParser renaming reversal part 3: move module into place and adapt imports.

This commit is contained in:
Georg Brandl 2008-05-25 07:25:25 +00:00
parent 995ee9dab0
commit 392c6fc02d
14 changed files with 68 additions and 126 deletions

View file

@ -1,4 +1,4 @@
import configparser
import ConfigParser
import StringIO
import unittest
import UserDict
@ -94,7 +94,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'),
@ -147,17 +147,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):
@ -170,13 +170,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:
@ -215,7 +215,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):
@ -324,7 +324,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()
@ -335,11 +335,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")
@ -375,7 +375,7 @@ class ConfigParserTestCase(TestCaseBase):
class RawConfigParserTestCase(TestCaseBase):
config_class = configparser.RawConfigParser
config_class = ConfigParser.RawConfigParser
def test_interpolation(self):
cf = self.get_interpolation_config()
@ -410,7 +410,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