From 08f0d37c621a7b9526c45209b3297427f83b2ef7 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Sun, 2 Mar 2025 12:13:45 -0500 Subject: [PATCH 1/2] Add test for opening non existent file --- test/test_basic.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/test_basic.py b/test/test_basic.py index 8595a46..edd1c81 100644 --- a/test/test_basic.py +++ b/test/test_basic.py @@ -310,6 +310,11 @@ def testCorruptFile(): with pytest.raises(rawpy.LibRawDataError): im.extract_thumb() +def testOpenNonExistentFile(): + with pytest.raises(rawpy.LibRawIOError): + with rawpy.open("nonexistent.nef") as f: + pass + def print_stats(rgb): print(rgb.dtype, np.min(rgb, axis=(0,1)), np.max(rgb, axis=(0,1)), # range for each channel From 4c4931461b0f96b9105f4ee4c4175f25b56dcc10 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Sun, 2 Mar 2025 13:19:38 -0500 Subject: [PATCH 2/2] open --> imread --- test/test_basic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_basic.py b/test/test_basic.py index edd1c81..6849719 100644 --- a/test/test_basic.py +++ b/test/test_basic.py @@ -312,7 +312,7 @@ def testCorruptFile(): def testOpenNonExistentFile(): with pytest.raises(rawpy.LibRawIOError): - with rawpy.open("nonexistent.nef") as f: + with rawpy.imread("nonexistent.nef") as f: pass def print_stats(rgb):