(tmpdir)
| 8 | |
| 9 | |
| 10 | def test_roundtrip(tmpdir): |
| 11 | # type: (Tempdir) -> None |
| 12 | |
| 13 | data = { |
| 14 | "top-level-key": ["a", "b", "c"], |
| 15 | "second": {"more-nest": 1 / 137, "on": True, "age": 53}, |
| 16 | } |
| 17 | |
| 18 | assert data == toml.loads(toml.dumps(data)) |
| 19 | |
| 20 | with open(tmpdir.join("example.toml"), "wb+") as fp: |
| 21 | toml.dump(data, fp) |
| 22 | fp.flush() |
| 23 | fp.seek(0) |
| 24 | assert data == toml.load(fp) |