    def test_version(self):
        """
        As of v4.0.0, __version__ is deprecated in favor of importlib.metadata.
        """

        message = "Accessing jsonschema.__version__ is deprecated"
        with self.assertWarnsRegex(DeprecationWarning, message) as w:
            from jsonschema import __version__

        self.assertEqual(__version__, importlib.metadata.version("jsonschema"))
        self.assertEqual(w.filename, __file__)
As of v4.0.0, __version__ is deprecated in favor of importlib.metadata.
jsonschema/tests/test_deprecations.py