mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
gh-76007: Deprecate __version__ attribute in decimal (#140302)
Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
This commit is contained in:
parent
33b2ca80bb
commit
00026d19c2
8 changed files with 74 additions and 7 deletions
|
|
@ -4474,7 +4474,7 @@ def test_module_attributes(self):
|
|||
self.assertTrue(C.HAVE_THREADS is True or C.HAVE_THREADS is False)
|
||||
self.assertTrue(P.HAVE_THREADS is True or P.HAVE_THREADS is False)
|
||||
|
||||
self.assertEqual(C.__version__, P.__version__)
|
||||
self.assertEqual(C.SPEC_VERSION, P.SPEC_VERSION)
|
||||
|
||||
self.assertLessEqual(set(dir(C)), set(dir(P)))
|
||||
self.assertEqual([n for n in dir(C) if n[:2] != '__'], sorted(P.__all__))
|
||||
|
|
@ -5929,6 +5929,23 @@ def doit(ty):
|
|||
doit('Context')
|
||||
|
||||
|
||||
class TestModule:
|
||||
def test_deprecated__version__(self):
|
||||
with self.assertWarnsRegex(
|
||||
DeprecationWarning,
|
||||
"'__version__' is deprecated and slated for removal in Python 3.20",
|
||||
) as cm:
|
||||
getattr(self.decimal, "__version__")
|
||||
self.assertEqual(cm.filename, __file__)
|
||||
|
||||
|
||||
@requires_cdecimal
|
||||
class CTestModule(TestModule, unittest.TestCase):
|
||||
decimal = C
|
||||
class PyTestModule(TestModule, unittest.TestCase):
|
||||
decimal = P
|
||||
|
||||
|
||||
def load_tests(loader, tests, pattern):
|
||||
if TODO_TESTS is not None:
|
||||
# Run only Arithmetic tests
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue