File: 0001-Fix-floating-point-comparison.patch

package info (click to toggle)
pyninjotiff 0.4.0-4
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 548 kB
  • sloc: python: 5,001; makefile: 7
file content (25 lines) | stat: -rw-r--r-- 970 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
From: Antonio Valentino <antonio.valentino@tiscali.it>
Date: Sat, 9 Dec 2023 08:31:40 +0000
Subject: Fix floating point comparison

Forwarded: https://github.com/pytroll/pyninjotiff/pull/33
---
 pyninjotiff/tests/test_ninjotiff.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/pyninjotiff/tests/test_ninjotiff.py b/pyninjotiff/tests/test_ninjotiff.py
index 2d4f224..870e75b 100644
--- a/pyninjotiff/tests/test_ninjotiff.py
+++ b/pyninjotiff/tests/test_ninjotiff.py
@@ -519,7 +519,10 @@ def test_write_rgb_tb():
         for key, val in tags.items():
             if key in ['datetime', '40002', '40003', '40006']:
                 continue
-            assert(val == read_tags[key].value)
+            if np.asarray(val).dtype.kind == "f":
+                np.testing.assert_allclose(val, read_tags[key].value)
+            else:
+                assert(val == read_tags[key].value)
 
 
 @pytest.mark.skip(reason="this is no implemented yet.")