vendor/Five/1.2b-r20590

view testing/testrunner-ex/sample1/sampletests/test121.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
17 import samplelayers
19 layername = 'samplelayers.Layer121'
20 layer = samplelayers.Layer121
22 x=0
23 y=0
24 z=0
26 class TestA(unittest.TestCase):
27 layer = layername
29 def setUp(self):
30 global x
31 x = 1
32 def tearDown(self):
33 global x
34 x = 0
35 def test_x1(self):
36 self.assertEqual(x, 1)
37 self.assertEqual(samplelayers.layer, layer.layer)
38 self.assertEqual(samplelayers.layerx, layer.layerx)
39 def test_y0(self):
40 self.assertEqual(y, 0)
41 self.assertEqual(samplelayers.layer, layer.layer)
42 self.assertEqual(samplelayers.layerx, layer.layerx)
43 def test_z0(self):
44 self.assertEqual(z, 0)
45 self.assertEqual(samplelayers.layer, layer.layer)
46 self.assertEqual(samplelayers.layerx, layer.layerx)
48 class TestB(unittest.TestCase):
49 layer = layername
51 def setUp(self):
52 global y
53 y = 1
54 def tearDown(self):
55 global y
56 y = 0
57 def test_y1(self):
58 self.assertEqual(y, 1)
59 self.assertEqual(samplelayers.layer, layer.layer)
60 self.assertEqual(samplelayers.layerx, layer.layerx)
61 def test_x0(self):
62 self.assertEqual(x, 0)
63 self.assertEqual(samplelayers.layer, layer.layer)
64 self.assertEqual(samplelayers.layerx, layer.layerx)
65 def test_z0(self):
66 self.assertEqual(z, 0)
67 self.assertEqual(samplelayers.layer, layer.layer)
68 self.assertEqual(samplelayers.layerx, layer.layerx)
71 class TestNotMuch(unittest.TestCase):
72 layer = layername
74 def test_1(self):
75 self.assertEqual(samplelayers.layer, layer.layer)
76 self.assertEqual(samplelayers.layerx, layer.layerx)
77 def test_2(self):
78 self.assertEqual(samplelayers.layer, layer.layer)
79 self.assertEqual(samplelayers.layerx, layer.layerx)
80 def test_3(self):
81 self.assertEqual(samplelayers.layer, layer.layer)
82 self.assertEqual(samplelayers.layerx, layer.layerx)
84 def setUp(test):
85 test.globs['z'] = 1
86 test.globs['layer'] = layer.layer
87 test.globs['layerx'] = layer.layerx
89 def test_y0(self):
90 """
91 >>> y
92 0
94 >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
95 (True, True)
96 """
98 def test_x0(self):
99 """
100 >>> x
101 0
103 >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
104 (True, True)
105 """
107 def test_z1(self):
108 """
109 >>> z
110 1
112 >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
113 (True, True)
114 """
116 def test_suite():
117 suite = unittest.TestSuite()
118 suite.addTest(unittest.makeSuite(TestA))
119 suite.addTest(unittest.makeSuite(TestB))
120 suite.addTest(unittest.makeSuite(TestNotMuch))
121 s = doctest.DocTestSuite(setUp=setUp)
122 s.layer = layer
123 suite.addTest(s)
124 s = doctest.DocFileSuite('../../sampletestsl.txt', setUp=setUp)
125 s.layer = layer
126 suite.addTest(s)
127 return suite