aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_postprocessor.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2025-09-23 07:44:44 -0400
committerLibravatarUnit 193 <unit193@unit193.net>2025-09-23 07:44:44 -0400
commit291c04af647559317fc9f9f392ad43841ec509ad (patch)
tree13a72906223927180001b362d086c82401cb7843 /test/test_postprocessor.py
parent065386e00c7a6c8bbe4bb23a545a7fc7b2c09a4a (diff)
parent42b62671fabfdcf983a9575221420d85f7fbcac1 (diff)
Update upstream source from tag 'upstream/1.30.8'
Update to upstream version '1.30.8' with Debian dir 51367313d3355f7d0d16a754c5c63135fb3c72e2
Diffstat (limited to 'test/test_postprocessor.py')
-rw-r--r--test/test_postprocessor.py25
1 files changed, 24 insertions, 1 deletions
diff --git a/test/test_postprocessor.py b/test/test_postprocessor.py
index 07bd348..2902fea 100644
--- a/test/test_postprocessor.py
+++ b/test/test_postprocessor.py
@@ -20,7 +20,7 @@ import collections
from datetime import datetime
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from gallery_dl import extractor, output, path, util # noqa E402
+from gallery_dl import extractor, output, path, util, exception # noqa E402
from gallery_dl import postprocessor, config # noqa E402
from gallery_dl.postprocessor.common import PostProcessor # noqa E402
@@ -555,6 +555,17 @@ class MetadataTest(BasePostprocessorTest):
test({"mode": "custom", "format": "{foo}\n{missing}\n"})
test({"format": "{foo}\n{missing}\n"})
+ def test_metadata_mode_print(self):
+ self._create(
+ {"mode": "print", "format": "{foo}\n{missing}"},
+ {"foo": "bar"},
+ )
+
+ with patch("sys.stdout", Mock()) as m:
+ self._trigger()
+
+ self.assertEqual(self._output(m), "bar\nNone\n")
+
def test_metadata_extfmt(self):
pp = self._create({
"extension" : "ignored",
@@ -867,6 +878,18 @@ class PythonTest(BasePostprocessorTest):
self._trigger()
self.assertEqual(self.pathfmt.kwdict["_result"], 24)
+ def test_eval(self):
+ self._create({"mode": "eval", "expression": "abort()"})
+
+ with self.assertRaises(exception.StopExtraction):
+ self._trigger()
+
+ def test_eval_auto(self):
+ self._create({"expression": "abort()"})
+
+ with self.assertRaises(exception.StopExtraction):
+ self._trigger()
+
def _write_module(self, path):
with open(path, "w") as fp:
fp.write("""