1- import ConfigParser
1+ import configparser
22import io
33import unittest
44import collections
@@ -89,7 +89,7 @@ def test_basic(self):
8989 "remove_option() failed to report non-existance of option"
9090 " that was removed" )
9191
92- self .assertRaises (ConfigParser .NoSectionError ,
92+ self .assertRaises (configparser .NoSectionError ,
9393 cf .remove_option , 'No Such Section' , 'foo' )
9494
9595 eq (cf .get ('Long Line' , 'foo' ),
@@ -142,17 +142,17 @@ def test_default_case_sensitivity(self):
142142
143143 def test_parse_errors (self ):
144144 self .newconfig ()
145- self .parse_error (ConfigParser .ParsingError ,
145+ self .parse_error (configparser .ParsingError ,
146146 "[Foo]\n extra-spaces: splat\n " )
147- self .parse_error (ConfigParser .ParsingError ,
147+ self .parse_error (configparser .ParsingError ,
148148 "[Foo]\n extra-spaces= splat\n " )
149- self .parse_error (ConfigParser .ParsingError ,
149+ self .parse_error (configparser .ParsingError ,
150150 "[Foo]\n option-without-value\n " )
151- self .parse_error (ConfigParser .ParsingError ,
151+ self .parse_error (configparser .ParsingError ,
152152 "[Foo]\n :value-without-option-name\n " )
153- self .parse_error (ConfigParser .ParsingError ,
153+ self .parse_error (configparser .ParsingError ,
154154 "[Foo]\n =value-without-option-name\n " )
155- self .parse_error (ConfigParser .MissingSectionHeaderError ,
155+ self .parse_error (configparser .MissingSectionHeaderError ,
156156 "No Section!\n " )
157157
158158 def parse_error (self , exc , src ):
@@ -165,13 +165,13 @@ def test_query_errors(self):
165165 "new ConfigParser should have no defined sections" )
166166 self .failIf (cf .has_section ("Foo" ),
167167 "new ConfigParser should have no acknowledged sections" )
168- self .assertRaises (ConfigParser .NoSectionError ,
168+ self .assertRaises (configparser .NoSectionError ,
169169 cf .options , "Foo" )
170- self .assertRaises (ConfigParser .NoSectionError ,
170+ self .assertRaises (configparser .NoSectionError ,
171171 cf .set , "foo" , "bar" , "value" )
172- self .get_error (ConfigParser .NoSectionError , "foo" , "bar" )
172+ self .get_error (configparser .NoSectionError , "foo" , "bar" )
173173 cf .add_section ("foo" )
174- self .get_error (ConfigParser .NoOptionError , "foo" , "bar" )
174+ self .get_error (configparser .NoOptionError , "foo" , "bar" )
175175
176176 def get_error (self , exc , section , option ):
177177 try :
@@ -210,7 +210,7 @@ def test_boolean(self):
210210 def test_weird_errors (self ):
211211 cf = self .newconfig ()
212212 cf .add_section ("Foo" )
213- self .assertRaises (ConfigParser .DuplicateSectionError ,
213+ self .assertRaises (configparser .DuplicateSectionError ,
214214 cf .add_section , "Foo" )
215215
216216 def test_write (self ):
@@ -314,7 +314,7 @@ def check_items_config(self, expected):
314314
315315
316316class ConfigParserTestCase (TestCaseBase ):
317- config_class = ConfigParser .ConfigParser
317+ config_class = configparser .ConfigParser
318318
319319 def test_interpolation (self ):
320320 cf = self .get_interpolation_config ()
@@ -325,11 +325,11 @@ def test_interpolation(self):
325325 "something with lots of interpolation (9 steps)" )
326326 eq (cf .get ("Foo" , "bar10" ),
327327 "something with lots of interpolation (10 steps)" )
328- self .get_error (ConfigParser .InterpolationDepthError , "Foo" , "bar11" )
328+ self .get_error (configparser .InterpolationDepthError , "Foo" , "bar11" )
329329
330330 def test_interpolation_missing_value (self ):
331331 cf = self .get_interpolation_config ()
332- e = self .get_error (ConfigParser .InterpolationError ,
332+ e = self .get_error (configparser .InterpolationError ,
333333 "Interpolation Error" , "name" )
334334 self .assertEqual (e .reference , "reference" )
335335 self .assertEqual (e .section , "Interpolation Error" )
@@ -365,7 +365,7 @@ def test_set_nonstring_types(self):
365365
366366
367367class RawConfigParserTestCase (TestCaseBase ):
368- config_class = ConfigParser .RawConfigParser
368+ config_class = configparser .RawConfigParser
369369
370370 def test_interpolation (self ):
371371 cf = self .get_interpolation_config ()
@@ -400,7 +400,7 @@ def test_set_nonstring_types(self):
400400
401401
402402class SafeConfigParserTestCase (ConfigParserTestCase ):
403- config_class = ConfigParser .SafeConfigParser
403+ config_class = configparser .SafeConfigParser
404404
405405 def test_safe_interpolation (self ):
406406 # See http://www.python.org/sf/511737
0 commit comments