[pp:metadata] implement format strings for 'directory' (#5728)

This commit is contained in:
Mike Fährmann
2024-07-06 01:01:54 +02:00
parent 8f3f061daf
commit da9916c01f
3 changed files with 33 additions and 3 deletions

View File

@@ -440,6 +440,18 @@ class MetadataTest(BasePostprocessorTest):
path = self.pathfmt.realdirectory + "metadata/file.json"
m.assert_called_once_with(path, "w", encoding="utf-8")
def test_metadata_directory_format(self):
self._create(
{"directory": ["..", "json", "\fF {id // 500 * 500 + 500}"]},
{"id": 12345},
)
with patch("builtins.open", mock_open()) as m:
self._trigger()
path = self.pathfmt.realdirectory + "../json/12500/file.ext.json"
m.assert_called_once_with(path, "w", encoding="utf-8")
def test_metadata_filename(self):
self._create({
"filename" : "{category}_{filename}_/meta/\n\r.data",