# This is a very unobtrusive test for the existence of the al module and all its
# attributes. More comprehensive examples can be found in Demo/al
-def main():
+def test_main():
# touch all the attributes of al without doing anything
if verbose:
print 'Touching al module attributes...'
print 'touching: ', attr
getattr(al, attr)
-main()
+
+if __name__ == '__main__':
+ test_main()
if not rv:
print 'Test FAILED for audioop.'+name+'()'
-def testall():
+def test_main():
data = [gendata1(), gendata2(), gendata4()]
names = dir(audioop)
# We know there is a routine 'add'
routines.append(n)
for n in routines:
testone(n, data)
-testall()
+
+
+
+if __name__ == '__main__':
+ test_main()
# attributes. More comprehensive examples can be found in Demo/cd and
# require that you have a CD and a CD ROM drive
-def main():
+def test_main():
# touch all the attributes of cd without doing anything
if verbose:
print 'Touching cd module attributes...'
print 'touching: ', attr
getattr(cd, attr)
-main()
+
+
+if __name__ == '__main__':
+ test_main()
# This is a very inobtrusive test for the existence of the cl
# module and all its attributes.
-def main():
+def test_main():
# touch all the attributes of al without doing anything
if verbose:
print 'Touching cl module attributes...'
print 'touching: ', attr
getattr(cl, attr)
-main()
+
+
+if __name__ == '__main__':
+ test_main()
d = dbm.open(filename, 'n')
d.close()
-cleanup()
-try:
- test_keys()
- test_modes()
-except:
+def test_main():
cleanup()
- raise
+ try:
+ test_keys()
+ test_modes()
+ except:
+ cleanup()
+ raise
-cleanup()
+ cleanup()
+
+
+
+if __name__ == '__main__':
+ test_main()
'xfpt4s', 'xfpti', 'xfpts', 'zbuffer', 'zclear', 'zdraw', 'zfunction',
'zsource', 'zwritemask']
-def main():
+def test_main():
# insure that we at least have an X display before continuing.
import os
try:
print 'winclose'
gl.winclose(w)
-main()
+
+if __name__ == '__main__':
+ test_main()
import warnings
-def main():
+def test_main():
# Create binary test files
uu.decode(get_qualified_path('testrgb'+os.extsep+'uue'), 'test'+os.extsep+'rgb')
return fullname
return name
-main()
+if __name__ == '__main__':
+ test_main()
import imgfile, uu
-def main():
-
- uu.decode(findfile('testrgb.uue'), 'test.rgb')
- uu.decode(findfile('greyrgb.uue'), 'greytest.rgb')
-
- # Test a 3 byte color image
- testimage('test.rgb')
-
- # Test a 1 byte greyscale image
- testimage('greytest.rgb')
-
- unlink('test.rgb')
- unlink('greytest.rgb')
-
def testimage(name):
"""Run through the imgfile's battery of possible methods
on the image passed in name.
os.unlink(outputfile)
-main()
+
+def test_main():
+
+ uu.decode(findfile('testrgb.uue'), 'test.rgb')
+ uu.decode(findfile('greyrgb.uue'), 'greytest.rgb')
+
+ # Test a 3 byte color image
+ testimage('test.rgb')
+
+ # Test a 1 byte greyscale image
+ testimage('greytest.rgb')
+
+ unlink('test.rgb')
+ unlink('greytest.rgb')
+
+if __name__ == '__main__':
+ test_main()
a.write(data)
a.close()
-def test():
+
+def test_main():
play_sound_file(findfile('audiotest.au'))
-test()
+
+
+if __name__ == '__main__':
+ test_main()