Skip to content

Instantly share code, notes, and snippets.

@tkutcher
Created February 19, 2022 18:25
Show Gist options
  • Save tkutcher/04248ca80867d179e40d6fe85508f2b7 to your computer and use it in GitHub Desktop.
Save tkutcher/04248ca80867d179e40d6fe85508f2b7 to your computer and use it in GitHub Desktop.
Python File IO Demo 5
def test_writes_config_properly(tmpdir):
dest_path = pathlib.Path(tmpdir) / "example-output.json"
assert not dest_path.exists()
config = MyConfig(x="4", y="18")
write_to_file(config, dest)
assert dest_path.exists()
assert read_from_file(dest_path).x == "4"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment