diff options
author | Batuhan Taskaya <batuhanosmantaskaya@gmail.com> | 2020-05-16 21:46:11 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-16 21:46:11 (GMT) |
commit | ce4a753dcb3eef3d68e892a6515490b1aa219651 (patch) | |
tree | 62557bc0b0fdc51f93363dd3b68a8fb2e71908af /Lib/test/test_unparse.py | |
parent | d5b3f6b7f9fc74438009af63f1de01bd77be9385 (diff) | |
download | cpython-ce4a753dcb3eef3d68e892a6515490b1aa219651.zip cpython-ce4a753dcb3eef3d68e892a6515490b1aa219651.tar.gz cpython-ce4a753dcb3eef3d68e892a6515490b1aa219651.tar.bz2 |
bpo-38870: Do not separate factor prefixes in ast.unparse (GH-20133)
Diffstat (limited to 'Lib/test/test_unparse.py')
-rw-r--r-- | Lib/test/test_unparse.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/test_unparse.py b/Lib/test/test_unparse.py index 2be44b2..1393bcc 100644 --- a/Lib/test/test_unparse.py +++ b/Lib/test/test_unparse.py @@ -347,7 +347,7 @@ class CosmeticTestCase(ASTTestCase): self.check_src_roundtrip("(1 + 2) / 3") self.check_src_roundtrip("(1 + 2) * 3 + 4 * (5 + 2)") self.check_src_roundtrip("(1 + 2) * 3 + 4 * (5 + 2) ** 2") - self.check_src_roundtrip("~ x") + self.check_src_roundtrip("~x") self.check_src_roundtrip("x and y") self.check_src_roundtrip("x and y and z") self.check_src_roundtrip("x and (y and x)") @@ -401,6 +401,12 @@ class CosmeticTestCase(ASTTestCase): self.check_ast_roundtrip(src) self.check_src_dont_roundtrip(src) + def test_unary_op_factor(self): + for prefix in ("+", "-", "~"): + self.check_src_roundtrip(f"{prefix}1") + for prefix in ("not",): + self.check_src_roundtrip(f"{prefix} 1") + class DirectoryTestCase(ASTTestCase): """Test roundtrip behaviour on all files in Lib and Lib/test.""" |