MCPcopy Index your code
hub / github.com/python/cpython / test_file

Method test_file

Lib/test/test_configparser.py:1532–1544  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1530
1531class ReadFileTestCase(unittest.TestCase):
1532 def test_file(self):
1533 file_paths = [support.findfile("cfgparser.1", subdir="configdata")]
1534 try:
1535 file_paths.append(file_paths[0].encode('utf8'))
1536 except UnicodeEncodeError:
1537 pass # unfortunately we can't test bytes on this path
1538 for file_path in file_paths:
1539 parser = configparser.ConfigParser()
1540 with open(file_path, encoding="utf-8") as f:
1541 parser.read_file(f)
1542 self.assertIn("Foo Bar", parser)
1543 self.assertIn("foo", parser["Foo Bar"])
1544 self.assertEqual(parser["Foo Bar"]["foo"], "newbar")
1545
1546 def test_iterable(self):
1547 lines = textwrap.dedent("""

Callers

nothing calls this directly

Calls 6

assertInMethod · 0.80
openFunction · 0.50
appendMethod · 0.45
encodeMethod · 0.45
read_fileMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected