~javiljoen/shopping-list

17b65e62833b4c3fa4abcd60ba61cbc1eb232fa0 — JA Viljoen 11 months ago 163831e master
Explicitly use UTF-8 for text files
2 files changed, 3 insertions(+), 3 deletions(-)

M src/groceries/txtdb.py
M tests/conftest.py
M src/groceries/txtdb.py => src/groceries/txtdb.py +2 -2
@@ 9,13 9,13 @@ class TextFile:
            self._init()

    def _load(self):
        with self._path.open("r") as fh:
        with self._path.open("r", encoding="utf-8") as fh:
            items = todotxt.load(fh)

        return {i.name: i for i in items}

    def _write(self, items):
        with self._path.open("w") as fh:
        with self._path.open("w", encoding="utf-8") as fh:
            todotxt.dump(items, fh)

    def _init(self):

M tests/conftest.py => tests/conftest.py +1 -1
@@ 23,7 23,7 @@ def items():
def groceries_file(tmpdir, items):
    path = Path(tmpdir) / "groceries.txt"

    with path.open("w") as fh:
    with path.open("w", encoding="utf-8") as fh:
        todotxt.dump(items, fh)

    return path