summaryrefslogtreecommitdiff
path: root/tests/auth_tests/test_views.py
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2020-05-10 13:03:39 -0700
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-05-11 12:01:28 +0200
commitd6aff369ad33457ae2355b5b210faf1c4890ff35 (patch)
tree4c9d43311078bd81098e8a9fe9ff89fe007e921e /tests/auth_tests/test_views.py
parent23f6fbdd93cd668740e3a1cd6d8c8259f380c0fe (diff)
Refs #30116 -- Simplified regex match group access with Match.__getitem__().
The method has been available since Python 3.6. The shorter syntax is also marginally faster.
Diffstat (limited to 'tests/auth_tests/test_views.py')
-rw-r--r--tests/auth_tests/test_views.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/auth_tests/test_views.py b/tests/auth_tests/test_views.py
index 48278e23f9..2f27fa7271 100644
--- a/tests/auth_tests/test_views.py
+++ b/tests/auth_tests/test_views.py
@@ -201,7 +201,7 @@ class PasswordResetTest(AuthViewsTestCase):
def _read_signup_email(self, email):
urlmatch = re.search(r"https?://[^/]*(/.*reset/\S*)", email.body)
self.assertIsNotNone(urlmatch, "No URL found in sent email")
- return urlmatch.group(), urlmatch.groups()[0]
+ return urlmatch[0], urlmatch[1]
def test_confirm_valid(self):
url, path = self._test_confirm_start()
@@ -414,7 +414,7 @@ class CustomUserPasswordResetTest(AuthViewsTestCase):
def _read_signup_email(self, email):
urlmatch = re.search(r"https?://[^/]*(/.*reset/\S*)", email.body)
self.assertIsNotNone(urlmatch, "No URL found in sent email")
- return urlmatch.group(), urlmatch.groups()[0]
+ return urlmatch[0], urlmatch[1]
def test_confirm_valid_custom_user(self):
url, path = self._test_confirm_start()
@@ -1215,7 +1215,7 @@ class ChangelistTests(AuthViewsTestCase):
rel_link = re.search(
r'you can change the password using <a href="([^"]*)">this form</a>',
response.content.decode()
- ).groups()[0]
+ )[1]
self.assertEqual(
os.path.normpath(user_change_url + rel_link),
os.path.normpath(password_change_url)