1 """Test module for the noddy examples
15 >>> n1 = noddy2.Noddy('jim', 'fulton', 42)
32 Traceback (most recent call last):
36 Traceback (most recent call last):
43 Traceback (most recent call last):
45 TypeError: can't delete numeric/char attribute
52 >>> n2 = noddy2.Noddy()
61 Traceback (most recent call last):
65 Traceback (most recent call last):
69 Traceback (most recent call last):
70 File "<stdin>", line 1, in ?
74 >>> n3 = noddy2.Noddy('jim', 'fulton', 'waaa')
75 Traceback (most recent call last):
76 File "<stdin>", line 1, in ?
77 TypeError: an integer is required
85 >>> n1 = noddy3.Noddy('jim', 'fulton', 42)
86 >>> n1 = noddy3.Noddy('jim', 'fulton', 42)
90 Traceback (most recent call last):
91 File "<stdin>", line 1, in ?
92 TypeError: Cannot delete the first attribute
94 Traceback (most recent call last):
95 File "<stdin>", line 1, in ?
96 TypeError: The first attribute value must be a string
100 >>> n2 = noddy3.Noddy()
101 >>> n2 = noddy3.Noddy()
102 >>> n2 = noddy3.Noddy()
103 >>> n3 = noddy3.Noddy('jim', 'fulton', 'waaa')
104 Traceback (most recent call last):
105 File "<stdin>", line 1, in ?
106 TypeError: an integer is required
113 >>> n1 = noddy4.Noddy('jim', 'fulton', 42)
122 >>> n1.first = 'will'
130 Traceback (most recent call last):
132 AttributeError: first
134 Traceback (most recent call last):
136 AttributeError: first
137 >>> n1.first = 'drew'
141 Traceback (most recent call last):
143 TypeError: can't delete numeric/char attribute
150 >>> n2 = noddy4.Noddy()
151 >>> n2 = noddy4.Noddy()
152 >>> n2 = noddy4.Noddy()
153 >>> n2 = noddy4.Noddy()
162 Traceback (most recent call last):
164 AttributeError: first
166 Traceback (most recent call last):
168 AttributeError: first
170 Traceback (most recent call last):
171 File "<stdin>", line 1, in ?
172 AttributeError: first
175 >>> n3 = noddy4.Noddy('jim', 'fulton', 'waaa')
176 Traceback (most recent call last):
177 File "<stdin>", line 1, in ?
178 TypeError: an integer is required
195 >>> sys.getrefcount(x)
197 >>> ignore = gc.collect()
198 >>> sys.getrefcount(x)
206 from distutils
.util
import get_platform
207 PLAT_SPEC
= "%s-%s" % (get_platform(), sys
.version
[0:3])
208 src
= os
.path
.join("build", "lib.%s" % PLAT_SPEC
)
211 if __name__
== "__main__":
212 import doctest
, __main__
213 doctest
.testmod(__main__
)