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

Add MatMul operator to patchedast #497

Merged
merged 5 commits into from
Jul 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# **Upcoming release**

## Bug fixes

- #496,#497 Add MatMul operator to patchedast

# Release 1.2.0

Date: 2022-04-22
Expand Down
1 change: 1 addition & 0 deletions rope/refactor/patchedast.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ def _child_nodes(self, nodes, separator):
"Div": "/",
"Mod": "%",
"Pow": "**",
"MatMult": "@",
"LShift": "<<",
"RShift": ">>",
"BitOr": "|",
Expand Down
6 changes: 6 additions & 0 deletions ropetest/refactor/patchedasttest.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,12 @@ def test_and_node(self):
checker.check_region("BoolOp", 0, len(source) - 1)
checker.check_children("BoolOp", [NameConstant, " ", "and", " ", NameConstant])

def test_matmult_node(self):
source = "a @ b\n"
ast_frag = patchedast.get_patched_ast(source, True)
checker = _ResultChecker(self, ast_frag)
checker.check_children("BinOp", ["Name", " ", "@", " ", "Name"])

def test_basic_closing_parens(self):
source = "1 + (2)\n"
ast_frag = patchedast.get_patched_ast(source, True)
Expand Down