Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1026694

Browse files
Remove polyfill for assertRaisesRegex function in unittest module (#123)
No longer needed since Python 2 support has been dropped
1 parent 1df8eb3 commit 1026694

5 files changed

Lines changed: 7 additions & 8 deletions

File tree

nrrd/tests/test_formatting.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
import unittest
2+
13
import numpy as np
24

35
import nrrd
4-
from nrrd.tests.util import *
56

67

78
class TestFieldFormatting(unittest.TestCase):

nrrd/tests/test_parsing.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
import unittest
2+
13
import numpy as np
24

35
import nrrd
4-
from nrrd.tests.util import *
56

67

78
class TestFieldParsing(unittest.TestCase):

nrrd/tests/test_reading.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import unittest
2+
13
import numpy as np
24

35
import nrrd

nrrd/tests/test_writing.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import io
22
import tempfile
3+
import unittest
34

45
import numpy as np
56

nrrd/tests/util.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import os
2-
import unittest
32
import warnings
43

54
# Enable all warnings
@@ -22,8 +21,3 @@
2221
ASCII_1D_NRRD_FILE_PATH = os.path.join(DATA_DIR_PATH, 'test1d_ascii.nrrd')
2322
ASCII_2D_NRRD_FILE_PATH = os.path.join(DATA_DIR_PATH, 'test2d_ascii.nrrd')
2423
ASCII_1D_CUSTOM_FIELDS_FILE_PATH = os.path.join(DATA_DIR_PATH, 'test_customFields.nrrd')
25-
26-
# Fix issue with assertRaisesRegex only available in Python 3 while
27-
# assertRaisesRegexp is available in Python 2 (and deprecated in Python 3)
28-
if not hasattr(unittest.TestCase, 'assertRaisesRegex'):
29-
unittest.TestCase.assertRaisesRegex = getattr(unittest.TestCase, 'assertRaisesRegexp')

0 commit comments

Comments
 (0)