Blob Blame History Raw
From 62c0663b62e820bf68efb55f1763b9dfd07d28c6 Mon Sep 17 00:00:00 2001
From: Karthikeyan Singaravelan <tir.karthi@gmail.com>
Date: Wed, 13 Oct 2021 08:51:54 +0000
Subject: [PATCH] Refactor deprecated unittest aliases for Python 3.11
 compatibility.

---
 src/icalendar/tests/test_icalendar.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/icalendar/tests/test_icalendar.py b/src/icalendar/tests/test_icalendar.py
index 24e5968..586e152 100644
--- a/src/icalendar/tests/test_icalendar.py
+++ b/src/icalendar/tests/test_icalendar.py
@@ -10,6 +10,10 @@
 
 class IcalendarTestCase (unittest.TestCase):
 
+    def setUp(self):
+        if not hasattr(self, 'assertRaisesRegex'):
+            self.assertRaisesRegex = self.assertRaisesRegexp
+
     def test_long_lines(self):
         from ..parser import Contentlines, Contentline
         c = Contentlines([Contentline('BEGIN:VEVENT')])
@@ -165,14 +169,14 @@ def test_contentline_class(self):
         )
 
         # And the traditional failure
-        with self.assertRaisesRegexp(
+        with self.assertRaisesRegex(
             ValueError,
             'Content line could not be parsed into parts'
         ):
             Contentline('ATTENDEE;maxm@example.com').parts()
 
         # Another failure:
-        with self.assertRaisesRegexp(
+        with self.assertRaisesRegex(
             ValueError,
             'Content line could not be parsed into parts'
         ):
@@ -189,7 +193,7 @@ def test_contentline_class(self):
         )
 
         # Should bomb on missing param:
-        with self.assertRaisesRegexp(
+        with self.assertRaisesRegex(
             ValueError,
             'Content line could not be parsed into parts'
         ):