vendor/Five/1.2b-r20590

view testing/testrunner-ex/samplelayers.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) 2004 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 ##############################################################################
14 """Sample test layers
16 $Id: samplelayers.py 18831 2005-10-21 18:07:37Z yuppie $
17 """
19 layer = '0' # Internal to samples. Not part of layer API
20 layerx = '0'
22 class Layer1:
23 # Internal to samples. Not part of layer API:
24 layer = '1'
25 base = '0'
26 layerx = '0'
28 def setUp(self):
29 global layer
30 if layer != self.base:
31 raise ValueError("Bad layer, %s, for %s." % (layer, self))
32 layer = self.layer
33 setUp = classmethod(setUp)
35 def tearDown(self):
36 global layer
37 if layer != self.layer:
38 raise ValueError("Bad layer, %s, for %s." % (layer, self))
39 layer = self.base
40 tearDown = classmethod(tearDown)
42 class Layerx:
43 layerx = '1' # Internal to samples. Not part of layer API
44 basex = '0'
46 def setUp(self):
47 global layerx
48 if layerx != self.basex:
49 raise ValueError("Bad layerx, %s, for %s." % (layerx, self))
50 layerx = self.layerx
51 setUp = classmethod(setUp)
53 def tearDown(self):
54 global layerx
55 if layerx != self.layerx:
56 raise ValueError("Bad layerx, %s, for %s." % (layerx, self))
57 layerx = self.basex
58 tearDown = classmethod(tearDown)
60 class Layer11(Layer1):
61 layer = '11' # Internal to samples. Not part of layer API
62 base = '1' # Internal to samples. Not part of layer API
64 class Layer12(Layer1):
65 layer = '12' # Internal to samples. Not part of layer API
66 base = '1' # Internal to samples. Not part of layer API
68 class Layer111(Layerx, Layer11):
69 layer = '111' # Internal to samples. Not part of layer API
70 base = '11' # Internal to samples. Not part of layer API
71 layerx = '2' # Internal to samples. Not part of layer API
72 basex = '1'
74 def setUp(self):
75 global layer
76 if layer != self.base:
77 raise ValueError("Bad layer, %s, for %s." % (layer, self))
78 layer = self.layer
79 global layerx
80 if layerx != self.basex:
81 raise ValueError("Bad layerx, %s, for %s." % (layerx, self))
82 layerx = self.layerx
83 setUp = classmethod(setUp)
85 def tearDown(self):
86 global layer
87 if layer != self.layer:
88 raise ValueError("Bad layer, %s, for %s." % (layer, self))
89 layer = self.base
90 global layerx
91 if layerx != self.layerx:
92 raise ValueError("Bad layerx, %s, for %s." % (layerx, self))
93 layerx = self.basex
94 tearDown = classmethod(tearDown)
96 class Layer121(Layer12):
97 layer = '121' # Internal to samples. Not part of layer API
98 base = '12' # Internal to samples. Not part of layer API
100 class Layer112(Layerx, Layer11):
101 layer = '112' # Internal to samples. Not part of layer API
102 base = '11' # Internal to samples. Not part of layer API
103 layerx = '2' # Internal to samples. Not part of layer API
104 basex = '1'
106 def setUp(self):
107 global layer
108 if layer != self.base:
109 raise ValueError("Bad layer, %s, for %s." % (layer, self))
110 layer = self.layer
111 global layerx
112 if layerx != self.basex:
113 raise ValueError("Bad layerx, %s, for %s." % (layerx, self))
114 layerx = self.layerx
115 setUp = classmethod(setUp)
117 def tearDown(self):
118 global layer
119 if layer != self.layer:
120 raise ValueError("Bad layer, %s, for %s." % (layer, self))
121 layer = self.base
122 global layerx
123 if layerx != self.layerx:
124 raise ValueError("Bad layerx, %s, for %s." % (layerx, self))
125 layerx = self.basex
126 tearDown = classmethod(tearDown)
128 class Layer122(Layer12):
129 layer = '122' # Internal to samples. Not part of layer API
130 base = '12' # Internal to samples. Not part of layer API