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

Method test_load

Lib/test/test_tomllib/test_misc.py:19–28  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

17
18class TestMiscellaneous(unittest.TestCase):
19 def test_load(self):
20 content = "one=1 \n two='two' \n arr=[]"
21 expected = {"one": 1, "two": "two", "arr": []}
22 with tempfile.TemporaryDirectory() as tmp_dir_path:
23 file_path = Path(tmp_dir_path) / "test.toml"
24 file_path.write_text(content)
25
26 with open(file_path, "rb") as bin_f:
27 actual = tomllib.load(bin_f)
28 self.assertEqual(actual, expected)
29
30 def test_incorrect_load(self):
31 content = "one=1"

Callers

nothing calls this directly

Calls 5

PathClass · 0.90
openFunction · 0.50
write_textMethod · 0.45
loadMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected