vendor/Five/1.2b-r20590

view testing/testrunner-ex/sample2/sampletests/testone.py @ 0:3673ed425f80

Vendor import of Five 1.2b+ (r20590)
author fguillaume
date Fri, 02 Dec 2005 20:25:42 +0000
parents
children
line source
1 ##############################################################################
2 #
3 # Copyright (c) 2003 Zope Corporation and Contributors.
4 # All Rights Reserved.
5 #
6 # This software is subject to the provisions of the Zope Public License,
7 # Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
8 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
9 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
10 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
11 # FOR A PARTICULAR PURPOSE.
12 #
13 ##############################################################################
15 import unittest
16 from Products.Five.testing import doctest
18 x=0
19 y=0
20 z=0
22 class TestA(unittest.TestCase):
23 def setUp(self):
24 global x
25 x = 1
26 def tearDown(self):
27 global x
28 x = 0
29 def test_x1(self):
30 self.assertEqual(x, 1)
31 def test_y0(self):
32 self.assertEqual(y, 0)
33 def test_z0(self):
34 self.assertEqual(z, 0)
36 class TestB(unittest.TestCase):
37 def setUp(self):
38 global y
39 y = 1
40 def tearDown(self):
41 global y
42 y = 0
43 def test_y1(self):
44 self.assertEqual(y, 1)
45 def test_x0(self):
46 self.assertEqual(x, 0)
47 def test_z0(self):
48 self.assertEqual(z, 0)
51 class TestNotMuch(unittest.TestCase):
52 def test_1(self):
53 pass
54 def test_2(self):
55 pass
56 def test_3(self):
57 pass
59 def setUp(test):
60 test.globs['z'] = 1
62 def test_y0(self):
63 """
64 >>> y
65 0
66 """
68 def test_x0(self):
69 """
70 >>> x
71 0
72 """
74 def test_z1(self):
75 """
76 >>> z
77 1
78 """
80 def test_suite():
81 suite = unittest.TestSuite()
82 suite.addTest(unittest.makeSuite(TestA))
83 suite.addTest(unittest.makeSuite(TestB))
84 suite.addTest(unittest.makeSuite(TestNotMuch))
85 suite.addTest(doctest.DocTestSuite(setUp=setUp))
86 suite.addTest(doctest.DocFileSuite('../../sampletests.txt',
87 setUp=setUp))
88 return suite