From e902dbd9ad1a045c29f295c0099e42f5ff7e91d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= Date: Wed, 13 Jan 2021 12:01:38 +0100 Subject: Remove deprecation warnings --- src/M2Crypto/SSL/Checker.py | 6 +++--- tests/test_obj.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/M2Crypto/SSL/Checker.py b/src/M2Crypto/SSL/Checker.py index 46d397a..a58186e 100644 --- a/src/M2Crypto/SSL/Checker.py +++ b/src/M2Crypto/SSL/Checker.py @@ -63,7 +63,7 @@ class WrongHost(SSLVerificationError): class Checker(object): - numericIpMatch = re.compile('^[0-9]+(\.[0-9]+)*$') + numericIpMatch = re.compile(r'^[0-9]+(\.[0-9]+)*$') def __init__(self, host=None, peerCertHash=None, peerCertDigest='sha1'): # type: (Optional[str], Optional[bytes], str) -> None @@ -253,8 +253,8 @@ class Checker(object): return False # Massage certHost so that it can be used in regex - certHost = certHost.replace('.', '\.') - certHost = certHost.replace('*', '[^\.]*') + certHost = certHost.replace('.', '\\.') + certHost = certHost.replace('*', '[^\\.]*') if re.compile('^%s$' % certHost).match(host): return True diff --git a/tests/test_obj.py b/tests/test_obj.py index 55854c3..5f3fe92 100644 --- a/tests/test_obj.py +++ b/tests/test_obj.py @@ -124,7 +124,7 @@ class ObjectsTestCase(unittest.TestCase): try: s.verify(p7, data) except SMIME.PKCS7_Error as e: - self.assertRegexpMatches(str(e), + six.assertRegex(self, str(e), "unable to get local issuer certificate", "Not received expected error message") -- cgit v1.2.1