mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
gh-104683: Remove unused variables from Tools/clinic
and tests for Tools/clinic
(#107771)
This commit is contained in:
parent
52fbcf61b5
commit
65ce3652fa
2 changed files with 3 additions and 8 deletions
|
@ -567,7 +567,6 @@ class ClinicWholeFileTest(TestCase):
|
||||||
self.expect_failure(block, err, lineno=6)
|
self.expect_failure(block, err, lineno=6)
|
||||||
|
|
||||||
def test_directive_preserve_output(self):
|
def test_directive_preserve_output(self):
|
||||||
err = "'preserve' only works for blocks that don't produce any output!"
|
|
||||||
block = dedent("""
|
block = dedent("""
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
output everything buffer
|
output everything buffer
|
||||||
|
@ -965,7 +964,6 @@ class ClinicParserTest(TestCase):
|
||||||
follow_symlinks: bool = True
|
follow_symlinks: bool = True
|
||||||
something_else: str = ''
|
something_else: str = ''
|
||||||
""")
|
""")
|
||||||
p = function.parameters['follow_symlinks']
|
|
||||||
self.assertEqual(3, len(function.parameters))
|
self.assertEqual(3, len(function.parameters))
|
||||||
conv = function.parameters['something_else'].converter
|
conv = function.parameters['something_else'].converter
|
||||||
self.assertIsInstance(conv, clinic.str_converter)
|
self.assertIsInstance(conv, clinic.str_converter)
|
||||||
|
@ -1929,10 +1927,6 @@ class ClinicParserTest(TestCase):
|
||||||
self.assertEqual(repr(clinic.NULL), '<Null>')
|
self.assertEqual(repr(clinic.NULL), '<Null>')
|
||||||
|
|
||||||
# test that fail fails
|
# test that fail fails
|
||||||
expected = (
|
|
||||||
'Error in file "clown.txt" on line 69:\n'
|
|
||||||
'The igloos are melting!\n'
|
|
||||||
)
|
|
||||||
with support.captured_stdout() as stdout:
|
with support.captured_stdout() as stdout:
|
||||||
errmsg = 'The igloos are melting'
|
errmsg = 'The igloos are melting'
|
||||||
with self.assertRaisesRegex(clinic.ClinicError, errmsg) as cm:
|
with self.assertRaisesRegex(clinic.ClinicError, errmsg) as cm:
|
||||||
|
@ -1940,6 +1934,7 @@ class ClinicParserTest(TestCase):
|
||||||
exc = cm.exception
|
exc = cm.exception
|
||||||
self.assertEqual(exc.filename, 'clown.txt')
|
self.assertEqual(exc.filename, 'clown.txt')
|
||||||
self.assertEqual(exc.lineno, 69)
|
self.assertEqual(exc.lineno, 69)
|
||||||
|
self.assertEqual(stdout.getvalue(), "")
|
||||||
|
|
||||||
def test_non_ascii_character_in_docstring(self):
|
def test_non_ascii_character_in_docstring(self):
|
||||||
block = """
|
block = """
|
||||||
|
@ -2408,7 +2403,7 @@ class ClinicExternalTest(TestCase):
|
||||||
"not overwriting!")
|
"not overwriting!")
|
||||||
self.assertIn(expected_err, err)
|
self.assertIn(expected_err, err)
|
||||||
# Run clinic again, this time with the -f option.
|
# Run clinic again, this time with the -f option.
|
||||||
out = self.expect_success("-f", in_fn)
|
_ = self.expect_success("-f", in_fn)
|
||||||
# Read back the generated output.
|
# Read back the generated output.
|
||||||
with open(in_fn, encoding="utf-8") as f:
|
with open(in_fn, encoding="utf-8") as f:
|
||||||
data = f.read()
|
data = f.read()
|
||||||
|
|
|
@ -186,7 +186,7 @@ def _main(filenames: list[str] | None = None) -> None:
|
||||||
cpp = Monitor(filename, verbose=True)
|
cpp = Monitor(filename, verbose=True)
|
||||||
print()
|
print()
|
||||||
print(filename)
|
print(filename)
|
||||||
for line_number, line in enumerate(f.read().split('\n'), 1):
|
for line in f:
|
||||||
cpp.writeline(line)
|
cpp.writeline(line)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue