From f2a5de466e91f919be720b8ea48a09d6bf243832 Mon Sep 17 00:00:00 2001 From: Brian McFee Date: Mon, 13 Jul 2020 08:56:40 -0400 Subject: [PATCH 1/2] fixes #17908 , updates frame_format to support all listed by animation writers --- lib/matplotlib/rcsetup.py | 6 ++++-- lib/matplotlib/tests/test_rcparams.py | 8 ++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/rcsetup.py b/lib/matplotlib/rcsetup.py index 7abde998778a..3c8bcf7d9c6f 100644 --- a/lib/matplotlib/rcsetup.py +++ b/lib/matplotlib/rcsetup.py @@ -747,7 +747,8 @@ def validate_movie_writer(s): validate_movie_frame_fmt = ValidateInStrings( - 'animation.frame_format', ['png', 'jpeg', 'tiff', 'raw', 'rgba'], + 'animation.frame_format', ['png', 'jpeg', 'tiff', 'raw', 'rgba', 'ppm', + 'sgi', 'bmp', 'pbm', 'svg'], _deprecated_since="3.3") validate_axis_locator = ValidateInStrings( 'major', ['minor', 'both', 'major'], _deprecated_since="3.3") @@ -1491,7 +1492,8 @@ def _convert_validator_spec(key, conv): "animation.codec": validate_string, "animation.bitrate": validate_int, # Controls image format when frames are written to disk - "animation.frame_format": ["png", "jpeg", "tiff", "raw", "rgba"], + "animation.frame_format": ["png", "jpeg", "tiff", "raw", "rgba", "ppm", + "sgi", "bmp", "pbm", "svg"], # Additional arguments for HTML writer "animation.html_args": validate_stringlist, # Path to ffmpeg binary. If just binary name, subprocess uses $PATH. diff --git a/lib/matplotlib/tests/test_rcparams.py b/lib/matplotlib/tests/test_rcparams.py index b34577a3ee93..aadf5711cb0d 100644 --- a/lib/matplotlib/tests/test_rcparams.py +++ b/lib/matplotlib/tests/test_rcparams.py @@ -204,6 +204,14 @@ def test_Issue_1713(tmpdir): assert rc.get('timezone') == 'UTC' +def test_Issue_17908(): + # Animation frame_format should allow any of the following + # if any of these are not allowed, an exception will be raised + for fmt in ['png', 'jpeg', 'tiff', 'raw', 'rgba', 'ppm', + 'sgi', 'bmp', 'pbm', 'svg']: + mpl.rcParams['animation.frame_format'] = fmt + + def generate_validator_testcases(valid): validation_tests = ( {'validator': validate_bool, From e0f074eefd0fdf66dbeb95f433eed5b18e1c06f9 Mon Sep 17 00:00:00 2001 From: Brian McFee Date: Mon, 13 Jul 2020 09:55:30 -0400 Subject: [PATCH 2/2] revised test name for animation format check --- lib/matplotlib/tests/test_rcparams.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/tests/test_rcparams.py b/lib/matplotlib/tests/test_rcparams.py index aadf5711cb0d..97ae564af1fe 100644 --- a/lib/matplotlib/tests/test_rcparams.py +++ b/lib/matplotlib/tests/test_rcparams.py @@ -204,9 +204,10 @@ def test_Issue_1713(tmpdir): assert rc.get('timezone') == 'UTC' -def test_Issue_17908(): +def test_animation_frame_formats(): # Animation frame_format should allow any of the following # if any of these are not allowed, an exception will be raised + # test for gh issue #17908 for fmt in ['png', 'jpeg', 'tiff', 'raw', 'rgba', 'ppm', 'sgi', 'bmp', 'pbm', 'svg']: mpl.rcParams['animation.frame_format'] = fmt