From cf5cfbd09fe4ab3f14e3f2a8d8dc8bc481450f14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corentin=20S=C3=A9chet?= Date: Wed, 22 May 2024 00:06:51 +0200 Subject: [PATCH] test: test Context.load works with both string and Path --- tests/test_context.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/test_context.py b/tests/test_context.py index bc6783d..917feb9 100644 --- a/tests/test_context.py +++ b/tests/test_context.py @@ -1,5 +1,7 @@ from pathlib import Path +from pytest import mark + from jweb.context import Context @@ -22,9 +24,10 @@ def test_jinja_localization(datadir: Path) -> None: assert ouput_file.read() == "Loutres" -def test_load(datadir: Path) -> None: +@mark.parametrize("path", ["content.txt", Path("content.txt")]) +def test_load(datadir: Path, path: str | Path) -> None: context = Context(datadir) - context.render("test-load.html", "output.html") + context.render("test-load.html", "output.html", path=path) with open(datadir / "build" / "output.html", encoding="utf-8") as ouput_file: assert ouput_file.read() == "Otters\n"