소스 검색

Added test for unary operator parentheses.

Taddeus Kroes 14 년 전
부모
커밋
821bdb8f84
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      tests/test_line.py

+ 4 - 0
tests/test_line.py

@@ -36,6 +36,10 @@ class TestLine(unittest.TestCase):
         exp = N('*', N('/', N('*', a, b), c), d)
         self.assertEquals(generate_line(exp), 'ab / c * d')
 
+    def test_parentheses_unary(self):
+        neg = N('-', N('+', L(1), L(2)))
+        self.assertEquals(generate_line(neg), '-(1 + 2)')
+
     def test_parentheses_nary(self):
         l0, l1, l2 = L(1), L(2), L(3)
         plus = N('+', N('+', l0, l1), l2)