Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove polyfill for assertRaisesRegex function in unittest module #123

Merged
merged 5 commits into from
Aug 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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')