Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: third_party/twisted_8_1/twisted/trial/test/test_doctest.py

Issue 12261012: Remove third_party/twisted_8_1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (c) 2001-2004 Twisted Matrix Laboratories.
2 # See LICENSE for details.
3
4 """
5 Test twisted's doctest support.
6 """
7
8 from twisted.trial import itrial, runner, unittest, reporter
9 from twisted.trial.test import mockdoctest
10
11
12 class TestRunners(unittest.TestCase):
13 """
14 Tests for Twisted's doctest support.
15 """
16
17 def test_id(self):
18 """
19 Check that the id() of the doctests' case object contains the FQPN of
20 the actual tests. We need this because id() has weird behaviour w/
21 doctest in Python 2.3.
22 """
23 loader = runner.TestLoader()
24 suite = loader.loadDoctests(mockdoctest)
25 idPrefix = 'twisted.trial.test.mockdoctest.Counter'
26 for test in suite._tests:
27 self.assertIn(idPrefix, itrial.ITestCase(test).id())
28
29
30 def makeDocSuite(self, module):
31 """
32 Return a L{runner.DocTestSuite} for the doctests in C{module}.
33 """
34 return self.assertWarns(
35 DeprecationWarning, "DocTestSuite is deprecated in Twisted 8.0.",
36 __file__, runner.DocTestSuite, mockdoctest)
37
38
39 def test_correctCount(self):
40 """
41 L{countTestCases} returns the number of doctests in the module.
42 """
43 suite = self.makeDocSuite(mockdoctest)
44 self.assertEqual(7, suite.countTestCases())
45
46
47 def test_basicTrialIntegration(self):
48 """
49 L{loadDoctests} loads all of the doctests in the given module.
50 """
51 loader = runner.TestLoader()
52 suite = loader.loadDoctests(mockdoctest)
53 self.assertEqual(7, suite.countTestCases())
54
55
56 def test_expectedResults(self):
57 """
58 Trial can correctly run doctests with its xUnit test APIs.
59 """
60 suite = self.makeDocSuite(mockdoctest)
61 result = reporter.TestResult()
62 suite.run(result)
63 self.assertEqual(5, result.successes)
64 # doctest reports failures as errors in 2.3
65 self.assertEqual(2, len(result.errors) + len(result.failures))
66
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698