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

Increase test coverage #46

Merged
merged 7 commits into from
Dec 17, 2019
Merged

Increase test coverage #46

merged 7 commits into from
Dec 17, 2019

Conversation

alexmojaki
Copy link
Contributor

No description provided.

@@ -167,8 +162,6 @@ def visit_tree(node, previsit, postvisit):

For the initial node, ``par_value`` is None. Either ``previsit`` and ``postvisit`` may be None.
Copy link
Member

Choose a reason for hiding this comment

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

It seems "previsit may be None" comment is no longer accurate.

@@ -99,10 +99,7 @@ def _visit_after_children(self, node, parent_token, token):
node.last_token = nlast

def _find_last_in_line(self, start_token):
try:
newline = self._code.find_token(start_token, token.NEWLINE)
except IndexError:
Copy link
Member

Choose a reason for hiding this comment

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

Mmmm, I have a feeling removing this except can easily cause an error. Why do you think it's better to remove?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm removing code that never runs. find_token doesn't advance past the end because it has a check and not token.ISEOF(t.type). We should maintain that guarantee and also trust it.

maybe_comma = self._code.next_token(last_token)
if util.match_token(maybe_comma, token.OP, ','):
last_token = maybe_comma
except IndexError:
Copy link
Member

Choose a reason for hiding this comment

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

Same here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

next_token can't raise an error here because there's always an endmarker in tokens, which I've just added a check for. If last_token is already the endmarker then that's a problem which should be fixed. I think our extensive tests, particularly for tuples, are sufficient.

assert filename == atok.filename


def test_doesnt_have_location():
Copy link
Member

Choose a reason for hiding this comment

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

Could you add a comment what this tests, please? The test name isn't self-explanatory.

Copy link
Member

@dsagal dsagal left a comment

Choose a reason for hiding this comment

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

Makes sense. Thank you! I had a couple of comments about fixing/adding comments -- maybe you could address, though not very important. Thank you very much!

@alexmojaki
Copy link
Contributor Author

Hey, you approved the changes, but I think you forgot you need to merge. Also please release afterwards. There's an actual bug that's been fixed here (the use of token.ASYNC) that's causing some failures here.

@dsagal dsagal merged commit f718f34 into gristlabs:master Dec 17, 2019
@dsagal
Copy link
Member

dsagal commented Dec 17, 2019

You got it.

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

Successfully merging this pull request may close these issues.

2 participants