Back to index

python3.2  3.2.2
Public Member Functions
test.test_cfgparser.ReadFileTestCase Class Reference

List of all members.

Public Member Functions

def test_file
def test_iterable
def test_readline_generator

Detailed Description

Definition at line 1361 of file test_cfgparser.py.


Member Function Documentation

Definition at line 1362 of file test_cfgparser.py.

01362 
01363     def test_file(self):
01364         file_path = support.findfile("cfgparser.1")
01365         parser = configparser.ConfigParser()
01366         with open(file_path) as f:
01367             parser.read_file(f)
01368         self.assertIn("Foo Bar", parser)
01369         self.assertIn("foo", parser["Foo Bar"])
01370         self.assertEqual(parser["Foo Bar"]["foo"], "newbar")

Here is the call graph for this function:

Definition at line 1371 of file test_cfgparser.py.

01371 
01372     def test_iterable(self):
01373         lines = textwrap.dedent("""
01374         [Foo Bar]
01375         foo=newbar""").strip().split('\n')
01376         parser = configparser.ConfigParser()
01377         parser.read_file(lines)
01378         self.assertIn("Foo Bar", parser)
01379         self.assertIn("foo", parser["Foo Bar"])
01380         self.assertEqual(parser["Foo Bar"]["foo"], "newbar")

Here is the call graph for this function:

Issue #11670.

Definition at line 1381 of file test_cfgparser.py.

01381 
01382     def test_readline_generator(self):
01383         """Issue #11670."""
01384         parser = configparser.ConfigParser()
01385         with self.assertRaises(TypeError):
01386             parser.read_file(FakeFile())
01387         parser.read_file(readline_generator(FakeFile()))
01388         self.assertIn("Foo Bar", parser)
01389         self.assertIn("foo", parser["Foo Bar"])
01390         self.assertEqual(parser["Foo Bar"]["foo"], "newbar")
01391 

Here is the call graph for this function:


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