Permalink
Browse files

Add more test coverage

  • Loading branch information...
andrewschaaf committed Feb 5, 2014
1 parent cc0dd33 commit 8b37f29a466cac4f43b46e39996d330b805df76f
Showing with 35 additions and 2 deletions.
  1. +35 −2 test.py
View
37 test.py
@@ -8,8 +8,41 @@ def assertPreserved(self, code):
result = codegen.to_source(ast.parse(code))
self.assertEqual(result.rstrip(), code.rstrip())
- def test_Pow(self):
- self.assertPreserved("y = (x ** 2)")
+ def test_BoolOp(self):
+ self.assertPreserved("(x and y)")
+ self.assertPreserved("(x or y)")
+
+ def test_BinOp(self):
+ self.assertPreserved("(x + y)")
+ self.assertPreserved("(x - y)")
+ self.assertPreserved("(x * y)")
+ self.assertPreserved("(x / y)")
+ self.assertPreserved("(x // y)")
+ self.assertPreserved("(x % y)")
+ self.assertPreserved("(x ** y)")
+ self.assertPreserved("(x << y)")
+ self.assertPreserved("(x >> y)")
+ self.assertPreserved("(x | y)")
+ self.assertPreserved("(x & y)")
+ self.assertPreserved("(x ^ y)")
+
+ def test_Compare(self):
+ self.assertPreserved("(x == y)")
+ self.assertPreserved("(x > y)")
+ self.assertPreserved("(x >= y)")
+ self.assertPreserved("(x in y)")
+ self.assertPreserved("(x is y)")
+ self.assertPreserved("(x is not y)")
+ self.assertPreserved("(x < y)")
+ self.assertPreserved("(x <= y)")
+ self.assertPreserved("(x != y)")
+ self.assertPreserved("(x not in y)")
+
+ def test_UnaryOp(self):
+ self.assertPreserved("(~x)")
+ self.assertPreserved("(not x)")
+ self.assertPreserved("(+x)")
+ self.assertPreserved("(-x)")
def test_del(self):
self.assertPreserved("del l[0]")

0 comments on commit 8b37f29

Please sign in to comment.