Skip to content

Commit

Permalink
Merge pull request #51 from tirkarthi/fix-assert
Browse files Browse the repository at this point in the history
Refactor deprecated unittest aliases for Python 3.11 compatibility.
  • Loading branch information
cpburnz authored Aug 13, 2022
2 parents 7ca27e2 + 46bad12 commit 365ffb0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pathspec/tests/test_gitwildmatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,11 @@ def test_09_single_exclamation_mark_fail(self):

def _check_invalid_pattern(self, git_ignore_pattern):
expected_message_pattern = re.escape(repr(git_ignore_pattern))
with self.assertRaisesRegexp(GitWildMatchPatternError, expected_message_pattern):
# assertRaisesRegexp was a deprecated alias removed in Python 3.11
if hasattr(self, 'assertRaisesRegex'):
assertRaisesRegex = self.assertRaisesRegex
else:
assertRaisesRegex = self.assertRaisesRegexp
with assertRaisesRegex(GitWildMatchPatternError, expected_message_pattern):
GitWildMatchPattern(git_ignore_pattern)

0 comments on commit 365ffb0

Please sign in to comment.