@@ -907,9 +907,6 @@ def test_interpolation(self):
907907 if self .interpolation == configparser ._UNSET :
908908 self .assertEqual (e .args , ("
9E81
;bar11" , "Foo" ,
909909 "something %(with11)s lots of interpolation (11 steps)" ))
910- elif isinstance (self .interpolation , configparser .LegacyInterpolation ):
911- self .assertEqual (e .args , ("bar11" , "Foo" ,
912- "something %(with11)s lots of interpolation (11 steps)" ))
913910
914911 def test_interpolation_missing_value (self ):
915912 cf = self .get_interpolation_config ()
@@ -921,9 +918,6 @@ def test_interpolation_missing_value(self):
921918 if self .interpolation == configparser ._UNSET :
922919 self .assertEqual (e .args , ('name' , 'Interpolation Error' ,
923920 '%(reference)s' , 'reference' ))
924- elif isinstance (self .interpolation , configparser .LegacyInterpolation ):
925- self .assertEqual (e .args , ('name' , 'Interpolation Error' ,
926- '%(reference)s' , 'reference' ))
927921
928922 def test_items (self ):
929923 self .check_items_config ([('default' , '<default>' ),
@@ -942,9 +936,6 @@ def test_safe_interpolation(self):
942936 self .assertEqual (cf .get ("section" , "ok" ), "xxx/%s" )
943937 if self .interpolation == configparser ._UNSET :
944938 self .assertEqual (cf .get ("section" , "not_ok" ), "xxx/xxx/%s" )
945- elif isinstance (self .interpolation , configparser .LegacyInterpolation ):
946- with self .assertRaises (TypeError ):
947- cf .get ("section" , "not_ok" )
948939
949940 def test_set_malformatted_interpolation (self ):
950941 cf = self .fromstring ("[sect]\n "
@@ -1025,31 +1016,6 @@ class CustomConfigParser(configparser.ConfigParser):
10251016 cf .read_string (self .ini )
10261017 self .assertMatchesIni (cf )
10271018
1028-
1029- class ConfigParserTestCaseLegacyInterpolation (ConfigParserTestCase ):
1030- config_class = configparser .ConfigParser
1031- with warnings .catch_warnings ():
1032- warnings .simplefilter ("ignore" , DeprecationWarning )
1033- interpolation = configparser .LegacyInterpolation ()
1034-
1035- def test_set_malformatted_interpolation (self ):
1036- cf = self .fromstring ("[sect]\n "
1037- "option1{eq}foo\n " .format (eq = self .delimiters [0 ]))
1038-
1039- self .assertEqual (cf .get ('sect' , "option1" ), "foo" )
1040-
1041- cf .set ("sect" , "option1" , "%foo" )
1042- self .assertEqual (cf .get ('sect' , "option1" ), "%foo" )
1043- cf .set ("sect" , "option1" , "foo%" )
1044- self .assertEqual (cf .get ('sect' , "option1" ), "foo%" )
1045- cf .set ("sect" , "option1" , "f%oo" )
1046- self .assertEqual (cf .get ('sect' , "option1" ), "f%oo" )
1047-
1048- # bug #5741: double percents are *not* malformed
1049- cf .set ("sect" , "option2" , "foo%%bar" )
1050- self .assertEqual (cf .get ("sect" , "option2" ), "foo%%bar" )
1051-
1052-
10531019class ConfigParserTestCaseInvalidInterpolationType (unittest .TestCase ):
10541020 def test_error_on_wrong_type_for_interpolation (self ):
10551021 for value in [configparser .ExtendedInterpolation , 42 , "a string" ]:
@@ -1636,14 +1602,6 @@ def test_interpolation_validation(self):
16361602 self .assertEqual (str (cm .exception ), "bad interpolation variable "
16371603 "reference '%(()'" )
16381604
1639- def test_legacyinterpolation_deprecation (self ):
1640- with warnings .catch_warnings (record = True ) as w :
1641- warnings .simplefilter ("always" , DeprecationWarning )
1642- configparser .LegacyInterpolation ()
1643- self .assertGreaterEqual (len (w ), 1 )
1644- for warning in w :
1645- self .assertIs (warning .category , DeprecationWarning )
1646-
16471605 def test_sectionproxy_repr (self ):
16481606 parser = configparser .ConfigParser ()
16491607 parser .read_string ("""
0 commit comments