prole/tests/ops/test_files.py
chrisfu 4ee2b259c9 Checkpoint: rename installer to knoe + harden db build context
- Add build-context helper to copy Docker context safely (ignore runtime data, keep symlinks)

- Update UI and core actions to use ~/.prole/build and shared copy helper

- Add/adjust tests and scripts; introduce knoe ops helpers and update manifests

Co-authored-by: Junie <junie@jetbrains.com>
2026-03-22 01:45:21 -07:00

20 lines
472 B
Python

from __future__ import annotations
from pathlib import Path
from knoe.ops.files import write_if_changed
def test_write_if_changed(tmp_path: Path):
p = tmp_path / "a.txt"
assert write_if_changed(p, "hello\n") is True
assert p.read_text(encoding="utf-8") == "hello\n"
# Unchanged
assert write_if_changed(p, "hello\n") is False
# Changed
assert write_if_changed(p, "hello2\n") is True
assert p.read_text(encoding="utf-8") == "hello2\n"