Пример #1
0
class TestPyUnitTestCase(TestCase):

    class PyUnitTest(pyunit.TestCase):

        def test_pass(self):
            pass


    def setUp(self):
        self.original = self.PyUnitTest('test_pass')
        self.test = ITestCase(self.original)


    def test_visit(self):
        """
        Trial assumes that test cases implement visit().
        """
        log = []
        def visitor(test):
            log.append(test)
        self.test.visit(visitor)
        self.assertEqual(log, [self.test])
    test_visit.suppress = [
        util.suppress(category=DeprecationWarning,
                      message="Test visitors deprecated in Twisted 8.0")]


    def test_callable(self):
        """
        Tests must be callable in order to be used with Python's unittest.py.
        """
        self.assertTrue(callable(self.test),
                        "%r is not callable." % (self.test,))
Пример #2
0
class TestPyUnitTestCase(TestCase):
    class PyUnitTest(pyunit.TestCase):
        def test_pass(self):
            pass

    def setUp(self):
        self.original = self.PyUnitTest('test_pass')
        self.test = ITestCase(self.original)

    def test_visit(self):
        """
        Trial assumes that test cases implement visit().
        """
        log = []

        def visitor(test):
            log.append(test)

        self.test.visit(visitor)
        self.assertEqual(log, [self.test])

    test_visit.suppress = [
        util.suppress(category=DeprecationWarning,
                      message="Test visitors deprecated in Twisted 8.0")
    ]

    def test_callable(self):
        """
        Tests must be callable in order to be used with Python's unittest.py.
        """
        self.assertTrue(callable(self.test),
                        "%r is not callable." % (self.test, ))