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-128742: Remove comments from find_assignment_target result #128743

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

WolframAlph
Copy link
Contributor

@WolframAlph WolframAlph commented Jan 11, 2025

def test_PyStackRef_FromPyObjectNew_with_comment(self):
input = """
inst(OP, (-- value)) {
// Comment is ok
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have more /* ... */ comments as well. And more than one comment as well? something like:

inst(OP, (-- value)) {
    // Comment is ok
	value = ...
}

inst(OP, (-- value)) {
    /* comment is ok */
	value = ...
}

inst(OP, (-- value)) {
    /* 
     comment is ok 
	*/
	value = ...
}

inst(OP, (-- value)) {
	// comment
	// comment
	value = ...
}

inst(OP, (-- value)) {
	// comment
	value = ...
	// comment
}

(I don't know which comments are actually accepted). The output being always the same, you can parametrize the test as follows:

output = ... 
line = "value = PyStackRef_FromPyObjectNew(GETITEM(FRAME_CO_CONSTS, oparg));"
for src in [
	("//", line),
	("// comment", line),
	("/* comment */", line),
    ...
]:
	lines = textwrap.indent('\n'.join(src), " " * 4)
	input = f"inst(OP, (-- value)) {{\n{lines}\n}}"
	with self.subTest(src=src):
		self.run_cases_test(input, output)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants