Reorganize and cleanup tests
This commit is contained in:
parent
ea452bd33c
commit
fac1bc782d
36 changed files with 1780 additions and 1592 deletions
34
llvm/tests/support.py
Normal file
34
llvm/tests/support.py
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import sys
|
||||
import unittest
|
||||
import contextlib
|
||||
from llvm.tests import tests, isolated_tests # re-expose symbol
|
||||
|
||||
IS_PY3K = sys.version_info[0] >= 3
|
||||
BITS = tuple.__itemsize__ * 8
|
||||
|
||||
if sys.version_info[:2] <= (2, 6):
|
||||
# create custom TestCase
|
||||
class TestCase(unittest.TestCase):
|
||||
def assertIn(self, item, container):
|
||||
self.assertTrue(item in container)
|
||||
|
||||
def assertNotIn(self, item, container):
|
||||
self.assertFalse(item in container)
|
||||
|
||||
def assertLess(self, a, b):
|
||||
self.assertTrue(a < b)
|
||||
|
||||
def assertIs(self, a, b):
|
||||
self.assertTrue(a is b)
|
||||
|
||||
@contextlib.contextmanager
|
||||
def assertRaises(self, exc):
|
||||
try:
|
||||
yield
|
||||
except exc:
|
||||
pass
|
||||
else:
|
||||
raise self.failureException("Did not raise %s" % exc)
|
||||
|
||||
else:
|
||||
TestCase = unittest.TestCase
|
||||
Loading…
Add table
Add a link
Reference in a new issue