Back to index

python3.2  3.2.2
Public Member Functions | Static Public Attributes
test.test_cfgparser.ConfigParserTestCaseTrickyFile Class Reference
Inheritance diagram for test.test_cfgparser.ConfigParserTestCaseTrickyFile:
Inheritance graph
[legend]
Collaboration diagram for test.test_cfgparser.ConfigParserTestCaseTrickyFile:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_cfgparser_dot_3
def test_unicode_failure
def newconfig
def fromstring

Static Public Attributes

 config_class = configparser.ConfigParser
dictionary delimiters = {'='}
dictionary comment_prefixes = {'#'}
 allow_no_value = True
tuple inline_comment_prefixes = (';', '#')
 empty_lines_in_values = True
 dict_type = configparser._default_dict
 strict = False
 default_section = configparser.DEFAULTSECT
 interpolation = configparser._UNSET

Detailed Description

Definition at line 1202 of file test_cfgparser.py.


Member Function Documentation

def test.test_cfgparser.CfgParserTestCaseClass.fromstring (   self,
  string,
  defaults = None 
) [inherited]

Reimplemented in test.test_cfgparser.CopyTestCase.

Definition at line 62 of file test_cfgparser.py.

00062 
00063     def fromstring(self, string, defaults=None):
00064         cf = self.newconfig(defaults)
00065         cf.read_string(string)
00066         return cf

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_cfgparser.CfgParserTestCaseClass.newconfig (   self,
  defaults = None 
) [inherited]

Definition at line 46 of file test_cfgparser.py.

00046 
00047     def newconfig(self, defaults=None):
00048         arguments = dict(
00049             defaults=defaults,
00050             allow_no_value=self.allow_no_value,
00051             delimiters=self.delimiters,
00052             comment_prefixes=self.comment_prefixes,
00053             inline_comment_prefixes=self.inline_comment_prefixes,
00054             empty_lines_in_values=self.empty_lines_in_values,
00055             dict_type=self.dict_type,
00056             strict=self.strict,
00057             default_section=self.default_section,
00058             interpolation=self.interpolation,
00059         )
00060         instance = self.config_class(**arguments)
00061         return instance

Here is the caller graph for this function:

Definition at line 1208 of file test_cfgparser.py.

01208 
01209     def test_cfgparser_dot_3(self):
01210         tricky = support.findfile("cfgparser.3")
01211         cf = self.newconfig()
01212         self.assertEqual(len(cf.read(tricky, encoding='utf-8')), 1)
01213         self.assertEqual(cf.sections(), ['strange',
01214                                          'corruption',
01215                                          'yeah, sections can be '
01216                                          'indented as well',
01217                                          'another one!',
01218                                          'no values here',
01219                                          'tricky interpolation',
01220                                          'more interpolation'])
01221         self.assertEqual(cf.getint(self.default_section, 'go',
01222                                    vars={'interpolate': '-1'}), -1)
01223         with self.assertRaises(ValueError):
01224             # no interpolation will happen
01225             cf.getint(self.default_section, 'go', raw=True,
01226                       vars={'interpolate': '-1'})
01227         self.assertEqual(len(cf.get('strange', 'other').split('\n')), 4)
01228         self.assertEqual(len(cf.get('corruption', 'value').split('\n')), 10)
01229         longname = 'yeah, sections can be indented as well'
01230         self.assertFalse(cf.getboolean(longname, 'are they subsections'))
01231         self.assertEqual(cf.get(longname, 'lets use some Unicode'), '片仮名')
01232         self.assertEqual(len(cf.items('another one!')), 5) # 4 in section and
01233                                                            # `go` from DEFAULT
01234         with self.assertRaises(configparser.InterpolationMissingOptionError):
01235             cf.items('no values here')
01236         self.assertEqual(cf.get('tricky interpolation', 'lets'), 'do this')
01237         self.assertEqual(cf.get('tricky interpolation', 'lets'),
01238                          cf.get('tricky interpolation', 'go'))
01239         self.assertEqual(cf.get('more interpolation', 'lets'), 'go shopping')

Here is the call graph for this function:

Definition at line 1240 of file test_cfgparser.py.

01240 
01241     def test_unicode_failure(self):
01242         tricky = support.findfile("cfgparser.3")
01243         cf = self.newconfig()
01244         with self.assertRaises(UnicodeDecodeError):
01245             cf.read(tricky, encoding='ascii')
01246 

Here is the call graph for this function:


Member Data Documentation

Reimplemented from test.test_cfgparser.CfgParserTestCaseClass.

Definition at line 1206 of file test_cfgparser.py.

Reimplemented from test.test_cfgparser.CfgParserTestCaseClass.

Definition at line 1205 of file test_cfgparser.py.

Definition at line 1203 of file test_cfgparser.py.

Reimplemented from test.test_cfgparser.CfgParserTestCaseClass.

Definition at line 1204 of file test_cfgparser.py.

test.test_cfgparser.CfgParserTestCaseClass.dict_type = configparser._default_dict [static, inherited]

Reimplemented in test.test_cfgparser.SortedTestCase.

Definition at line 41 of file test_cfgparser.py.

Reimplemented in test.test_cfgparser.RawConfigParserTestSambaConf.

Definition at line 40 of file test_cfgparser.py.


The documentation for this class was generated from the following file: