test: test Context.load works with both string and Path
This commit is contained in:
parent
77c30117ed
commit
cf5cfbd09f
|
|
@ -1,5 +1,7 @@
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
from pytest import mark
|
||||||
|
|
||||||
from jweb.context import Context
|
from jweb.context import Context
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -22,9 +24,10 @@ def test_jinja_localization(datadir: Path) -> None:
|
||||||
assert ouput_file.read() == "Loutres"
|
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 = 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:
|
with open(datadir / "build" / "output.html", encoding="utf-8") as ouput_file:
|
||||||
assert ouput_file.read() == "Otters\n"
|
assert ouput_file.read() == "Otters\n"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue