mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-113336: Remove the 'version' directive from Argument Clinic (#113341)
The 'version' directive was introduced with gh-63929 in Nov 2013. It has not been in use in the CPython code base, and the 'version' variable has never been bumped.
This commit is contained in:
parent
4b90b5d857
commit
fae096cd4b
2 changed files with 0 additions and 117 deletions
|
@ -8,7 +8,6 @@ from test.support import os_helper
|
|||
from test.support.os_helper import TESTFN, unlink
|
||||
from textwrap import dedent
|
||||
from unittest import TestCase
|
||||
import contextlib
|
||||
import inspect
|
||||
import os.path
|
||||
import re
|
||||
|
@ -264,70 +263,6 @@ class ClinicWholeFileTest(TestCase):
|
|||
)
|
||||
self.expect_failure(raw, err)
|
||||
|
||||
@staticmethod
|
||||
@contextlib.contextmanager
|
||||
def _clinic_version(new_version):
|
||||
"""Helper for test_version_*() tests"""
|
||||
_saved = clinic.version
|
||||
clinic.version = new_version
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
clinic.version = _saved
|
||||
|
||||
def test_version_directive(self):
|
||||
dataset = (
|
||||
# (clinic version, required version)
|
||||
('3', '2'), # required version < clinic version
|
||||
('3.1', '3.0'), # required version < clinic version
|
||||
('1.2b0', '1.2a7'), # required version < clinic version
|
||||
('5', '5'), # required version == clinic version
|
||||
('6.1', '6.1'), # required version == clinic version
|
||||
('1.2b3', '1.2b3'), # required version == clinic version
|
||||
)
|
||||
for clinic_version, required_version in dataset:
|
||||
with self.subTest(clinic_version=clinic_version,
|
||||
required_version=required_version):
|
||||
with self._clinic_version(clinic_version):
|
||||
block = dedent(f"""
|
||||
/*[clinic input]
|
||||
version {required_version}
|
||||
[clinic start generated code]*/
|
||||
""")
|
||||
self.clinic.parse(block)
|
||||
|
||||
def test_version_directive_insufficient_version(self):
|
||||
with self._clinic_version('4'):
|
||||
err = (
|
||||
"Insufficient Clinic version!\n"
|
||||
" Version: 4\n"
|
||||
" Required: 5"
|
||||
)
|
||||
block = """
|
||||
/*[clinic input]
|
||||
version 5
|
||||
[clinic start generated code]*/
|
||||
"""
|
||||
self.expect_failure(block, err)
|
||||
|
||||
def test_version_directive_illegal_char(self):
|
||||
err = "Illegal character 'v' in version string 'v5'"
|
||||
block = """
|
||||
/*[clinic input]
|
||||
version v5
|
||||
[clinic start generated code]*/
|
||||
"""
|
||||
self.expect_failure(block, err)
|
||||
|
||||
def test_version_directive_unsupported_string(self):
|
||||
err = "Unsupported version string: '.-'"
|
||||
block = """
|
||||
/*[clinic input]
|
||||
version .-
|
||||
[clinic start generated code]*/
|
||||
"""
|
||||
self.expect_failure(block, err)
|
||||
|
||||
def test_clone_mismatch(self):
|
||||
err = "'kind' of function and cloned function don't match!"
|
||||
block = """
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue