aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/Jinja2/py3/tests/conftest.py
diff options
context:
space:
mode:
authornkozlovskiy <nmk@ydb.tech>2023-09-29 12:24:06 +0300
committernkozlovskiy <nmk@ydb.tech>2023-09-29 12:41:34 +0300
commite0e3e1717e3d33762ce61950504f9637a6e669ed (patch)
treebca3ff6939b10ed60c3d5c12439963a1146b9711 /contrib/python/Jinja2/py3/tests/conftest.py
parent38f2c5852db84c7b4d83adfcb009eb61541d1ccd (diff)
downloadydb-e0e3e1717e3d33762ce61950504f9637a6e669ed.tar.gz
add ydb deps
Diffstat (limited to 'contrib/python/Jinja2/py3/tests/conftest.py')
-rw-r--r--contrib/python/Jinja2/py3/tests/conftest.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/contrib/python/Jinja2/py3/tests/conftest.py b/contrib/python/Jinja2/py3/tests/conftest.py
new file mode 100644
index 0000000000..218c3c77cf
--- /dev/null
+++ b/contrib/python/Jinja2/py3/tests/conftest.py
@@ -0,0 +1,50 @@
+from pathlib import Path
+
+import pytest
+
+from jinja2 import loaders
+from jinja2.environment import Environment
+
+
+@pytest.fixture
+def env():
+ """returns a new environment."""
+ return Environment()
+
+
+@pytest.fixture
+def dict_loader():
+ """returns DictLoader"""
+ return loaders.DictLoader({"justdict.html": "FOO"})
+
+
+@pytest.fixture
+def package_loader():
+ """returns PackageLoader initialized from templates"""
+ return loaders.PackageLoader("res", "templates")
+
+
+@pytest.fixture
+def filesystem_loader():
+ """returns FileSystemLoader initialized to res/templates directory"""
+ import yatest.common
+ here = Path(yatest.common.test_source_path())
+ return loaders.FileSystemLoader(here / "res" / "templates")
+
+
+@pytest.fixture
+def function_loader():
+ """returns a FunctionLoader"""
+ return loaders.FunctionLoader({"justfunction.html": "FOO"}.get)
+
+
+@pytest.fixture
+def choice_loader(dict_loader, package_loader):
+ """returns a ChoiceLoader"""
+ return loaders.ChoiceLoader([dict_loader, package_loader])
+
+
+@pytest.fixture
+def prefix_loader(filesystem_loader, dict_loader):
+ """returns a PrefixLoader"""
+ return loaders.PrefixLoader({"a": filesystem_loader, "b": dict_loader})