Skip to content

Commit

Permalink
Remove polyfill for assertRaisesRegex function in unittest module (#123)
Browse files Browse the repository at this point in the history
No longer needed since Python 2 support has been dropped
  • Loading branch information
addisonElliott authored Aug 27, 2022
1 parent 1df8eb3 commit 1026694
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
3 changes: 2 additions & 1 deletion nrrd/tests/test_formatting.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import unittest

import numpy as np

import nrrd
from nrrd.tests.util import *


class TestFieldFormatting(unittest.TestCase):
Expand Down
3 changes: 2 additions & 1 deletion nrrd/tests/test_parsing.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import unittest

import numpy as np

import nrrd
from nrrd.tests.util import *


class TestFieldParsing(unittest.TestCase):
Expand Down
2 changes: 2 additions & 0 deletions nrrd/tests/test_reading.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import unittest

import numpy as np

import nrrd
Expand Down
1 change: 1 addition & 0 deletions nrrd/tests/test_writing.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import io
import tempfile
import unittest

import numpy as np

Expand Down
6 changes: 0 additions & 6 deletions nrrd/tests/util.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import unittest
import warnings

# Enable all warnings
Expand All @@ -22,8 +21,3 @@
ASCII_1D_NRRD_FILE_PATH = os.path.join(DATA_DIR_PATH, 'test1d_ascii.nrrd')
ASCII_2D_NRRD_FILE_PATH = os.path.join(DATA_DIR_PATH, 'test2d_ascii.nrrd')
ASCII_1D_CUSTOM_FIELDS_FILE_PATH = os.path.join(DATA_DIR_PATH, 'test_customFields.nrrd')

# Fix issue with assertRaisesRegex only available in Python 3 while
# assertRaisesRegexp is available in Python 2 (and deprecated in Python 3)
if not hasattr(unittest.TestCase, 'assertRaisesRegex'):
unittest.TestCase.assertRaisesRegex = getattr(unittest.TestCase, 'assertRaisesRegexp')

0 comments on commit 1026694

Please sign in to comment.