[med-svn] [Git][med-team/simpleitk][master] Backport Python 3.7 test fix from upstream to fix Python index test with empty comparison

Andreas Tille gitlab at salsa.debian.org
Sun Dec 2 21:36:48 GMT 2018


Andreas Tille pushed to branch master at Debian Med / simpleitk


Commits:
7f2a618e by Andreas Tille at 2018-12-02T21:36:21Z
Backport Python 3.7 test fix from upstream to fix Python index test with empty comparison

- - - - -


3 changed files:

- debian/changelog
- + debian/patches/Fix-Python-index-test-with-empty-comparison.patch
- debian/patches/series


Changes:

=====================================
debian/changelog
=====================================
@@ -1,9 +1,15 @@
 simpleitk (1.0.1-3) UNRELEASED; urgency=medium
 
+  [ Dylan Aïssi ]
   * Team upload.
   * Add references to registries.
 
- -- Dylan Aïssi <bob.dybian at gmail.com>  Wed, 25 Apr 2018 23:04:26 +0200
+  [ Matthias Klose ]
+  * Backport Python 3.7 test fix from upstream to fix Python index test
+    with empty comparison
+    Closes: #912583
+
+ -- Andreas Tille <tille at debian.org>  Sun, 02 Dec 2018 22:34:26 +0100
 
 simpleitk (1.0.1-2) unstable; urgency=medium
 


=====================================
debian/patches/Fix-Python-index-test-with-empty-comparison.patch
=====================================
@@ -0,0 +1,47 @@
+From: Bradley Lowekamp <blowekamp at mail.nih.gov>
+Date: Thu, 16 Aug 2018 09:50:39 -0400
+Bug-Debian: https://bugs.debian.org/912583
+Subject: [PATCH] Fix Python index test with empty comparison
+
+This addresses a test failure with Python 3.7 due to a change in the
+StopIteration exception handling from PEP 479.
+
+This test case has a slice index which results in an empty image. The
+iteration produces a StopIteration exception which with Python 3.7 is
+converted into a Run-time exception:
+
+Traceback (most recent call last):
+  File
+  "/home/circleci/SimpleITK/Testing/Unit/Python/ImageIndexingTest.py",
+  line 87, in test_2d
+    self.assertImageNDArrayEquals(img[-4:-1:-2,-2:-1:1],nda[-2:-1:1,-4:-1:-2])
+  File
+  "/home/circleci/SimpleITK/Testing/Unit/Python/ImageIndexingTest.py",
+  line 35, in assertImageNDArrayEquals
+    for p,n in zip(img, nda.flat):
+RuntimeError: generator raised StopIteration
+---
+ Testing/Unit/Python/ImageIndexingTest.py | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/Testing/Unit/ImageIndexingTest.py b/Testing/Unit/Python/ImageIndexingTest.py
+index 2740f6e62..c9889de7c 100644
+--- a/Testing/Unit/ImageIndexingTest.py
++++ b/Testing/Unit/ImageIndexingTest.py
+@@ -69,6 +69,7 @@ def test_2d(self):
+         self.assertEqual(len(img[:,2:1]), 0)
+         self.assertEqual(len(img[-6:0,:]), 0)
+         self.assertEqual(len(img[0:0,:]), 0)
++        self.assertEqual(len(img[-4:-1:-2,-2:-1:1]), 0)
+ 
+ 
+ 
+@@ -84,7 +85,7 @@ def test_2d(self):
+ 
+         # some negative cases
+         self.assertImageNDArrayEquals(img[-4:-1,-2:-1],nda[-2:-1,-4:-1])
+-        self.assertImageNDArrayEquals(img[-4:-1:-2,-2:-1:1],nda[-2:-1:1,-4:-1:-2])
++        self.assertImageNDArrayEquals(img[-1:-4:-2,-2:-1:1],nda[-2:-1:1,-1:-4:-2])
+         self.assertImageNDArrayEquals(img[::-1,:],nda[:,::-1])
+ 
+         # check some exceptions


=====================================
debian/patches/series
=====================================
@@ -1,3 +1,4 @@
 Fix-build-with-ITKV3_COMPATIBILITY-enabled.patch
 Fix-path-created-for-output-of-4D-images-in-test.patch
 Relax-the-short-image-testing-tolerance.patch
+Fix-Python-index-test-with-empty-comparison.patch



View it on GitLab: https://salsa.debian.org/med-team/simpleitk/commit/7f2a618e8fe15ea71d0886626ea81c7759952849

-- 
View it on GitLab: https://salsa.debian.org/med-team/simpleitk/commit/7f2a618e8fe15ea71d0886626ea81c7759952849
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20181202/64556ab3/attachment-0001.html>


More information about the debian-med-commit mailing list