@@ -907,9 +907,6 @@ def test_interpolation(self):
907
907
if self .interpolation == configparser ._UNSET :
908
908
self .assertEqual (e .args , ("bar11" , "Foo" ,
909
909
"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)" ))
913
910
914
911
def test_interpolation_missing_value (self ):
915
912
cf = self .get_interpolation_config ()
@@ -921,9 +918,6 @@ def test_interpolation_missing_value(self):
921
918
if self .interpolation == configparser ._UNSET :
922
919
self .assertEqual (e .args , ('name' , 'Interpolation Error' ,
923
920
'%(reference)s' , 'reference' ))
924
- elif isinstance (self .interpolation , configparser .LegacyInterpolation ):
925
- self .assertEqual (e .args , ('name' , 'Interpolation Error' ,
926
- '%(reference)s' , 'reference' ))
927
921
928
922
def test_items (self ):
929
923
self .check_items_config ([('default' , '<default>' ),
@@ -942,9 +936,6 @@ def test_safe_interpolation(self):
942
936
self .assertEqual (cf .get ("section" , "ok" ), "xxx/%s" )
943
937
if self .interpolation == configparser ._UNSET :
944
938
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" )
948
939
949
940
def test_set_malformatted_interpolation (self ):
950
941
cf = self .fromstring ("[sect]\n "
@@ -1025,31 +1016,6 @@ class CustomConfigParser(configparser.ConfigParser):
1025
1016
cf .read_string (self .ini )
1026
1017
self .assertMatchesIni (cf )
1027
1018
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
DD41
- # 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
-
1053
1019
class ConfigParserTestCaseInvalidInterpolationType (unittest .TestCase ):
1054
1020
def test_error_on_wrong_type_for_interpolation (self ):
1055
1021
for value in [configparser .ExtendedInterpolation , 42 , "a string" ]:
@@ -1636,14 +1602,6 @@ def test_interpolation_validation(self):
1636
1602
self .assertEqual (str (cm .exception ), "bad interpolation variable "
1637
1603
"reference '%(()'" )
1638
1604
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
-
1647
1605
def test_sectionproxy_repr (self ):
1648
1606
parser = configparser .ConfigParser ()
1649
1607
parser .read_string ("""
0 commit comments