[3.10] bpo-43988: Add test.support.check_disallow_instantiation() (GH-25757) (GH-26885)

(cherry picked from commit 4f725261c6, fbff5387c3, and 8cec740820)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>

Automerge-Triggered-By: GH:vstinner
This commit is contained in:
Erlend Egeberg Aasland 2021-06-24 01:46:25 +02:00 committed by GitHub
parent ece3841d3d
commit 0a3452e7cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 58 additions and 53 deletions

View file

@ -358,11 +358,7 @@ class BasicSocketTests(unittest.TestCase):
with self.subTest(ssl_type=ssl_type):
with self.assertRaisesRegex(TypeError, "immutable type"):
ssl_type.value = None
with self.assertRaisesRegex(
TypeError,
"cannot create '_ssl.Certificate' instances"
):
_ssl.Certificate()
support.check_disallow_instantiation(self, _ssl.Certificate)
def test_private_init(self):
with self.assertRaisesRegex(TypeError, "public constructor"):