Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-104683: Remove unused variables from Tools/clinic and tests for Tools/clinic #107771

Merged
merged 2 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions Lib/test/test_clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,6 @@ def test_directive_preserve_input(self):
self.expect_failure(block, err, lineno=6)

def test_directive_preserve_output(self):
err = "'preserve' only works for blocks that don't produce any output!"
block = dedent("""
/*[clinic input]
output everything buffer
Expand Down Expand Up @@ -895,8 +894,9 @@ def test_param_no_docstring(self):
follow_symlinks: bool = True
something_else: str = ''
""")
p = function.parameters['follow_symlinks']
self.assertEqual(3, len(function.parameters))
p = function.parameters['follow_symlinks']
self.assertIsInstance(p, clinic.bool_converter)
conv = function.parameters['something_else'].converter
self.assertIsInstance(conv, clinic.str_converter)

Expand Down Expand Up @@ -1849,17 +1849,14 @@ def test_scaffolding(self):
self.assertEqual(repr(clinic.NULL), '<Null>')

# 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:
errmsg = 'The igloos are melting'
with self.assertRaisesRegex(clinic.ClinicError, errmsg) as cm:
clinic.fail(errmsg, filename='clown.txt', line_number=69)
exc = cm.exception
self.assertEqual(exc.filename, 'clown.txt')
self.assertEqual(exc.lineno, 69)
self.assertEqual(stdout.getvalue(), "")
erlend-aasland marked this conversation as resolved.
Show resolved Hide resolved

def test_non_ascii_character_in_docstring(self):
block = """
Expand Down Expand Up @@ -2299,7 +2296,7 @@ def test_file_dest(self):
"not overwriting!")
self.assertIn(expected_err, err)
# 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.
with open(in_fn, encoding="utf-8") as f:
data = f.read()
Expand Down
2 changes: 1 addition & 1 deletion Tools/clinic/cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def _main(filenames: list[str] | None = None) -> None:
cpp = Monitor(filename, verbose=True)
print()
print(filename)
for line_number, line in enumerate(f.read().split('\n'), 1):
for line in f:
erlend-aasland marked this conversation as resolved.
Show resolved Hide resolved
cpp.writeline(line)


Expand Down
Loading