[python-bindings] Fixed 3 test failures caused by typos.
authorMichael Gottesman <mgottesman@apple.com>
Wed, 11 Sep 2013 00:41:02 +0000 (00:41 +0000)
committerMichael Gottesman <mgottesman@apple.com>
Wed, 11 Sep 2013 00:41:02 +0000 (00:41 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190465 91177308-0d34-0410-b5e6-96231b3b80d8

bindings/python/llvm/core.py
bindings/python/llvm/tests/test_core.py

index f7f3748d4c3d477d8a6e35fab30308efe5e97dc0..19b4bbec256752d60d3965a162cc53454609b626 100644 (file)
@@ -125,8 +125,9 @@ class Module(LLVMObject):
 
     def print_module_to_file(self, filename):
         out = c_char_p(None)
-        result = lib.LLVMPrintModuleToFile(self, filename, byref(out))
-        if not result:
+        # Result is inverted so 0 means everything was ok.
+        result = lib.LLVMPrintModuleToFile(self, filename, byref(out))        
+        if result:
             raise RuntimeError("LLVM Error: %s" % out.value)
 
 class Context(LLVMObject):
index e5fffbae59cc1cfac7db4b036981ad1790e12457..07a574e585802bcfa0a145a8b20cd470adea9e6f 100644 (file)
@@ -37,7 +37,7 @@ class TestCore(TestBase):
 
     def test_create_module_with_name(self):
         # Make sure we can not create a module without a LLVMModuleRef.
-        with self.assertRaises(RuntimeError):
+        with self.assertRaises(TypeError):
             m = Module()
         m = Module.CreateWithName("test-module")
 
@@ -49,7 +49,8 @@ class TestCore(TestBase):
 
     def test_module_getset_target(self):
         m = Module.CreateWithName("test-module")
-        m.target = "thumbv7-apple-ios5.0.0"
+        target = "thumbv7-apple-ios5.0.0"
+        m.target = target
         self.assertEqual(m.target, target)
 
     def test_module_print_module_to_file(self):