From bc73fe3a370ac87160842394a60f5372c710700d Mon Sep 17 00:00:00 2001 From: narugo1992 Date: Tue, 10 Sep 2024 11:41:00 +0800 Subject: [PATCH] dev(narugo): final check --- test/sd/test_nai.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/sd/test_nai.py b/test/sd/test_nai.py index e0929bf945..123fa084d7 100644 --- a/test/sd/test_nai.py +++ b/test/sd/test_nai.py @@ -278,6 +278,26 @@ def test_save_image_with_naimeta_lsb_true(self, nai3_clear_file, nai3_meta_witho save_image_with_naimeta(nai3_clear_file, f'image{ext}', add_lsb_meta=True, metadata=nai3_meta_without_title) + @pytest.mark.parametrize(['ext', 'okay'], [ + ('.png', True), + ('.webp', True), + ('.jpg', True), + ('.jpeg', True), + ('.tiff', False), + ('.gif', True), + ]) + def test_save_image_with_naimeta_metainfo_true(self, nai3_clear_file, nai3_meta_without_title, + ext, okay): + with isolated_directory(): + if okay: + save_image_with_naimeta(nai3_clear_file, f'image{ext}', + save_metainfo=True, metadata=nai3_meta_without_title) + assert get_naimeta_from_image(f'image{ext}') == pytest.approx(nai3_meta_without_title) + else: + with pytest.raises(SystemError): + save_image_with_naimeta(nai3_clear_file, f'image{ext}', + save_metainfo=True, metadata=nai3_meta_without_title) + @pytest.mark.parametrize(['ext', 'warns', 'okay'], [ ('.png', False, True), ('.webp', False, True),