]> granicus.if.org Git - python/commitdiff
Mass check-in after untabifying all files that need it.
authorGuido van Rossum <guido@python.org>
Thu, 26 Mar 1998 19:42:58 +0000 (19:42 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 26 Mar 1998 19:42:58 +0000 (19:42 +0000)
36 files changed:
Lib/test/regrtest.py
Lib/test/test_al.py
Lib/test/test_array.py
Lib/test/test_audioop.py
Lib/test/test_binascii.py
Lib/test/test_binhex.py
Lib/test/test_bsddb.py
Lib/test/test_cd.py
Lib/test/test_cl.py
Lib/test/test_cmath.py
Lib/test/test_dbm.py
Lib/test/test_dl.py
Lib/test/test_errno.py
Lib/test/test_exceptions.py
Lib/test/test_gl.py
Lib/test/test_grp.py
Lib/test/test_imageop.py
Lib/test/test_imgfile.py
Lib/test/test_new.py
Lib/test/test_nis.py
Lib/test/test_opcodes.py
Lib/test/test_operator.py
Lib/test/test_pkg.py
Lib/test/test_pow.py
Lib/test/test_pwd.py
Lib/test/test_re.py
Lib/test/test_regex.py
Lib/test/test_rgbimg.py
Lib/test/test_select.py
Lib/test/test_socket.py
Lib/test/test_strftime.py
Lib/test/test_strop.py
Lib/test/test_struct.py
Lib/test/test_sunaudiodev.py
Lib/test/test_time.py
Lib/test/test_unpack.py

index abd40a63997818d0de457b603ce13fd4219743e8..41e750f8f322137992116a52c6a6ec3ab057dc6f 100755 (executable)
@@ -30,58 +30,58 @@ import test_support
 
 def main():
     try:
-       opts, args = getopt.getopt(sys.argv[1:], 'vgqx')
+        opts, args = getopt.getopt(sys.argv[1:], 'vgqx')
     except getopt.error, msg:
-       print msg
-       print __doc__
-       return 2
+        print msg
+        print __doc__
+        return 2
     verbose = 0
     quiet = 0
     generate = 0
     exclude = 0
     for o, a in opts:
-       if o == '-v': verbose = verbose+1
-       if o == '-q': quiet = 1; verbose = 0
-       if o == '-g': generate = 1
-       if o == '-x': exclude = 1
+        if o == '-v': verbose = verbose+1
+        if o == '-q': quiet = 1; verbose = 0
+        if o == '-g': generate = 1
+        if o == '-x': exclude = 1
     if generate and verbose:
-       print "-g and -v don't go together!"
-       return 2
+        print "-g and -v don't go together!"
+        return 2
     good = []
     bad = []
     skipped = []
     for i in range(len(args)):
-       # Strip trailing ".py" from arguments
-       if args[i][-3:] == '.py':
-           args[i] = args[i][:-3]
+        # Strip trailing ".py" from arguments
+        if args[i][-3:] == '.py':
+            args[i] = args[i][:-3]
     if exclude:
-       nottests[:0] = args
-       args = []
+        nottests[:0] = args
+        args = []
     tests = args or findtests()
-    test_support.verbose = verbose     # Tell tests to be moderately quiet
+    test_support.verbose = verbose      # Tell tests to be moderately quiet
     for test in tests:
-       if not quiet:
-           print test
-       ok = runtest(test, generate, verbose)
-       if ok > 0:
-           good.append(test)
-       elif ok == 0:
-           bad.append(test)
-       else:
-           if not quiet:
-               print "test", test,
-               print "skipped -- an optional feature could not be imported"
-           skipped.append(test)
+        if not quiet:
+            print test
+        ok = runtest(test, generate, verbose)
+        if ok > 0:
+            good.append(test)
+        elif ok == 0:
+            bad.append(test)
+        else:
+            if not quiet:
+                print "test", test,
+                print "skipped -- an optional feature could not be imported"
+            skipped.append(test)
     if good and not quiet:
-       if not bad and not skipped and len(good) > 1:
-           print "All",
-       print count(len(good), "test"), "OK."
+        if not bad and not skipped and len(good) > 1:
+            print "All",
+        print count(len(good), "test"), "OK."
     if bad:
-       print count(len(bad), "test"), "failed:",
-       print string.join(bad)
+        print count(len(bad), "test"), "failed:",
+        print string.join(bad)
     if skipped and not quiet:
-       print count(len(skipped), "test"), "skipped:",
-       print string.join(skipped)
+        print count(len(skipped), "test"), "skipped:",
+        print string.join(skipped)
     return len(bad) > 0
 
 stdtests = [
@@ -105,10 +105,10 @@ def findtests():
     names = os.listdir(testdir)
     tests = []
     for name in names:
-       if name[:5] == "test_" and name[-3:] == ".py":
-           modname = name[:-3]
-           if modname not in stdtests and modname not in nottests:
-               tests.append(modname)
+        if name[:5] == "test_" and name[-3:] == ".py":
+            modname = name[:-3]
+            if modname not in stdtests and modname not in nottests:
+                tests.append(modname)
     tests.sort()
     return stdtests + tests
 
@@ -118,76 +118,76 @@ def runtest(test, generate, verbose):
     outputdir = os.path.join(testdir, "output")
     outputfile = os.path.join(outputdir, test)
     try:
-       if generate:
-           cfp = open(outputfile, "w")
-       elif verbose:
-           cfp = sys.stdout
-       else:
-           cfp = Compare(outputfile)
+        if generate:
+            cfp = open(outputfile, "w")
+        elif verbose:
+            cfp = sys.stdout
+        else:
+            cfp = Compare(outputfile)
     except IOError:
-       cfp = None
-       print "Warning: can't open", outputfile
+        cfp = None
+        print "Warning: can't open", outputfile
     try:
-       save_stdout = sys.stdout
-       try:
-           if cfp:
-               sys.stdout = cfp
-               print test              # Output file starts with test name
-           __import__(test, globals(), locals(), [])
-       finally:
-           sys.stdout = save_stdout
+        save_stdout = sys.stdout
+        try:
+            if cfp:
+                sys.stdout = cfp
+                print test              # Output file starts with test name
+            __import__(test, globals(), locals(), [])
+        finally:
+            sys.stdout = save_stdout
     except ImportError, msg:
-       return -1
+        return -1
     except KeyboardInterrupt, v:
-       raise KeyboardInterrupt, v, sys.exc_info()[2]
+        raise KeyboardInterrupt, v, sys.exc_info()[2]
     except test_support.TestFailed, msg:
-       print "test", test, "failed --", msg
-       return 0
+        print "test", test, "failed --", msg
+        return 0
     except:
-       type, value = sys.exc_info()[:2]
-       print "test", test, "crashed --", type, ":", value
-       if verbose:
-           traceback.print_exc(file=sys.stdout)
-       return 0
+        type, value = sys.exc_info()[:2]
+        print "test", test, "crashed --", type, ":", value
+        if verbose:
+            traceback.print_exc(file=sys.stdout)
+        return 0
     else:
-       return 1
+        return 1
 
 def findtestdir():
     if __name__ == '__main__':
-       file = sys.argv[0]
+        file = sys.argv[0]
     else:
-       file = __file__
+        file = __file__
     testdir = os.path.dirname(file) or os.curdir
     return testdir
 
 def count(n, word):
     if n == 1:
-       return "%d %s" % (n, word)
+        return "%d %s" % (n, word)
     else:
-       return "%d %ss" % (n, word)
+        return "%d %ss" % (n, word)
 
 class Compare:
 
     def __init__(self, filename):
-       self.fp = open(filename, 'r')
+        self.fp = open(filename, 'r')
 
     def write(self, data):
-       expected = self.fp.read(len(data))
-       if data <> expected:
-           raise test_support.TestFailed, \
-                   'Writing: '+`data`+', expected: '+`expected`
+        expected = self.fp.read(len(data))
+        if data <> expected:
+            raise test_support.TestFailed, \
+                    'Writing: '+`data`+', expected: '+`expected`
 
     def flush(self):
-       pass
+        pass
 
     def close(self):
-       leftover = self.fp.read()
-       if leftover:
-           raise test_support.TestFailed, 'Unread: '+`leftover`
-       self.fp.close()
+        leftover = self.fp.read()
+        if leftover:
+            raise test_support.TestFailed, 'Unread: '+`leftover`
+        self.fp.close()
 
     def isatty(self):
-       return 0
+        return 0
 
 if __name__ == '__main__':
     sys.exit(main())
index b8ea868aa276423c494d139370bc96f60ab68530..587bf1f353e70ec722a849d5c208a68e34a69c47 100755 (executable)
@@ -6,7 +6,7 @@ import al
 from test_support import verbose
 
 alattrs = ['__doc__', '__name__', 'getdefault', 'getminmax', 'getname', 'getparams',
-          'newconfig', 'openport', 'queryparams', 'setparams']
+           'newconfig', 'openport', 'queryparams', 'setparams']
 
 # This is a very inobstrusive test for the existance of the al module and all it's
 # attributes.  More comprehensive examples can be found in Demo/al
@@ -14,11 +14,11 @@ alattrs = ['__doc__', '__name__', 'getdefault', 'getminmax', 'getname', 'getpara
 def main():
     # touch all the attributes of al without doing anything
     if verbose:
-       print 'Touching al module attributes...'
+        print 'Touching al module attributes...'
     for attr in alattrs:
-       if verbose:
-           print 'touching: ', attr
-       getattr(al, attr)
+        if verbose:
+            print 'touching: ', attr
+        getattr(al, attr)
 
 main()
 
index e95fac4891e1af605e2536b559b5359039fb5913..6a0d17c3c2ac3bc2d46d7cc9f5b92a046211c7bf 100755 (executable)
@@ -10,50 +10,50 @@ def main():
     testtype('c', 'c')
 
     for type in (['b', 'h', 'i', 'l', 'f', 'd']):
-       testtype(type, 1)
+        testtype(type, 1)
 
     unlink(TESTFN)
 
 
 def testtype(type, example):
 
-       a = array.array(type)
-       a.append(example)
-       if verbose:
-           print 40*'*'
-           print 'array after append: ', a
-       a.typecode
-       a.itemsize
-       if a.typecode in ('i', 'b', 'h', 'l'):
-           a.byteswap()
-
-       if a.typecode == 'c':
-           f = open(TESTFN, "w")
-           f.write("The quick brown fox jumps over the lazy dog.\n")
-           f.close()
-           f = open(TESTFN, 'r')
-           a.fromfile(f, 10)
-           f.close()
-           if verbose:
-               print 'char array with 10 bytes of TESTFN appended: ', a
-           a.fromlist(['a', 'b', 'c'])
-           if verbose:
-               print 'char array with list appended: ', a
-
-       a.insert(0, example)
-       if verbose:
-           print 'array of %s after inserting another:' % a.typecode, a
-       f = open(TESTFN, 'w')
-       a.tofile(f)
-       f.close()
-       a.tolist()
-       a.tostring()
-       if verbose:
-           print 'array of %s converted to a list: ' % a.typecode, a.tolist()
-       if verbose:
-           print 'array of %s converted to a string: ' \
-                  % a.typecode, `a.tostring()`
+        a = array.array(type)
+        a.append(example)
+        if verbose:
+            print 40*'*'
+            print 'array after append: ', a
+        a.typecode
+        a.itemsize
+        if a.typecode in ('i', 'b', 'h', 'l'):
+            a.byteswap()
+
+        if a.typecode == 'c':
+            f = open(TESTFN, "w")
+            f.write("The quick brown fox jumps over the lazy dog.\n")
+            f.close()
+            f = open(TESTFN, 'r')
+            a.fromfile(f, 10)
+            f.close()
+            if verbose:
+                print 'char array with 10 bytes of TESTFN appended: ', a
+            a.fromlist(['a', 'b', 'c'])
+            if verbose:
+                print 'char array with list appended: ', a
+
+        a.insert(0, example)
+        if verbose:
+            print 'array of %s after inserting another:' % a.typecode, a
+        f = open(TESTFN, 'w')
+        a.tofile(f)
+        f.close()
+        a.tolist()
+        a.tostring()
+        if verbose:
+            print 'array of %s converted to a list: ' % a.typecode, a.tolist()
+        if verbose:
+            print 'array of %s converted to a string: ' \
+                   % a.typecode, `a.tostring()`
 
 
 main()
-       
+        
index a03fe60ac5c4dcb9b0ee2f622d9e67dd2f879cd8..900ec58a536629e78e59939be5be8a8e7c3ac82a 100644 (file)
@@ -7,166 +7,166 @@ def gendata1():
 
 def gendata2():
     if verbose:
-       print 'getsample'
+        print 'getsample'
     if audioop.getsample('\0\1', 2, 0) == 1:
-       return '\0\0\0\1\0\2'
+        return '\0\0\0\1\0\2'
     else:
-       return '\0\0\1\0\2\0'
+        return '\0\0\1\0\2\0'
 
 def gendata4():
     if verbose:
-       print 'getsample'
+        print 'getsample'
     if audioop.getsample('\0\0\0\1', 4, 0) == 1:
-       return '\0\0\0\0\0\0\0\1\0\0\0\2'
+        return '\0\0\0\0\0\0\0\1\0\0\0\2'
     else:
-       return '\0\0\0\0\1\0\0\0\2\0\0\0'
+        return '\0\0\0\0\1\0\0\0\2\0\0\0'
 
 def testmax(data):
     if verbose:
-       print 'max'
+        print 'max'
     if audioop.max(data[0], 1) <> 2 or \
-             audioop.max(data[1], 2) <> 2 or \
-             audioop.max(data[2], 4) <> 2:
-       return 0
+              audioop.max(data[1], 2) <> 2 or \
+              audioop.max(data[2], 4) <> 2:
+        return 0
     return 1
 
 def testminmax(data):
     if verbose:
-       print 'minmax'
+        print 'minmax'
     if audioop.minmax(data[0], 1) <> (0, 2) or \
-             audioop.minmax(data[1], 2) <> (0, 2) or \
-             audioop.minmax(data[2], 4) <> (0, 2):
-       return 0
+              audioop.minmax(data[1], 2) <> (0, 2) or \
+              audioop.minmax(data[2], 4) <> (0, 2):
+        return 0
     return 1
 
 def testmaxpp(data):
     if verbose:
-       print 'maxpp'
+        print 'maxpp'
     if audioop.maxpp(data[0], 1) <> 0 or \
-             audioop.maxpp(data[1], 2) <> 0 or \
-             audioop.maxpp(data[2], 4) <> 0:
-       return 0
+              audioop.maxpp(data[1], 2) <> 0 or \
+              audioop.maxpp(data[2], 4) <> 0:
+        return 0
     return 1
 
 def testavg(data):
     if verbose:
-       print 'avg'
+        print 'avg'
     if audioop.avg(data[0], 1) <> 1 or \
-             audioop.avg(data[1], 2) <> 1 or \
-             audioop.avg(data[2], 4) <> 1:
-       return 0
+              audioop.avg(data[1], 2) <> 1 or \
+              audioop.avg(data[2], 4) <> 1:
+        return 0
     return 1
 
 def testavgpp(data):
     if verbose:
-       print 'avgpp'
+        print 'avgpp'
     if audioop.avgpp(data[0], 1) <> 0 or \
-             audioop.avgpp(data[1], 2) <> 0 or \
-             audioop.avgpp(data[2], 4) <> 0:
-       return 0
+              audioop.avgpp(data[1], 2) <> 0 or \
+              audioop.avgpp(data[2], 4) <> 0:
+        return 0
     return 1
 
 def testrms(data):
     if audioop.rms(data[0], 1) <> 1 or \
-             audioop.rms(data[1], 2) <> 1 or \
-             audioop.rms(data[2], 4) <> 1:
-       return 0
+              audioop.rms(data[1], 2) <> 1 or \
+              audioop.rms(data[2], 4) <> 1:
+        return 0
     return 1
 
 def testcross(data):
     if verbose:
-       print 'cross'
+        print 'cross'
     if audioop.cross(data[0], 1) <> 0 or \
-             audioop.cross(data[1], 2) <> 0 or \
-             audioop.cross(data[2], 4) <> 0:
-       return 0
+              audioop.cross(data[1], 2) <> 0 or \
+              audioop.cross(data[2], 4) <> 0:
+        return 0
     return 1
 
 def testadd(data):
     if verbose:
-       print 'add'
+        print 'add'
     data2 = []
     for d in data:
-       str = ''
-       for s in d:
-           str = str + chr(ord(s)*2)
-       data2.append(str)
+        str = ''
+        for s in d:
+            str = str + chr(ord(s)*2)
+        data2.append(str)
     if audioop.add(data[0], data[0], 1) <> data2[0] or \
-             audioop.add(data[1], data[1], 2) <> data2[1] or \
-             audioop.add(data[2], data[2], 4) <> data2[2]:
-       return 0
+              audioop.add(data[1], data[1], 2) <> data2[1] or \
+              audioop.add(data[2], data[2], 4) <> data2[2]:
+        return 0
     return 1
 
 def testbias(data):
     if verbose:
-       print 'bias'
+        print 'bias'
     # Note: this test assumes that avg() works
     d1 = audioop.bias(data[0], 1, 100)
     d2 = audioop.bias(data[1], 2, 100)
     d4 = audioop.bias(data[2], 4, 100)
     if audioop.avg(d1, 1) <> 101 or \
-             audioop.avg(d2, 2) <> 101 or \
-             audioop.avg(d4, 4) <> 101:
-       return 0
+              audioop.avg(d2, 2) <> 101 or \
+              audioop.avg(d4, 4) <> 101:
+        return 0
     return 1
 
 def testlin2lin(data):
     if verbose:
-       print 'lin2lin'
+        print 'lin2lin'
     # too simple: we test only the size
     for d1 in data:
-       for d2 in data:
-           got = len(d1)/3
-           wtd = len(d2)/3
-           if len(audioop.lin2lin(d1, got, wtd)) <> len(d2):
-               return 0
+        for d2 in data:
+            got = len(d1)/3
+            wtd = len(d2)/3
+            if len(audioop.lin2lin(d1, got, wtd)) <> len(d2):
+                return 0
     return 1
 
 def testadpcm2lin(data):
     # Very cursory test
     if audioop.adpcm2lin('\0\0', 1, None) <> ('\0\0\0\0', (0,0)):
-       return 0
+        return 0
     return 1
 
 def testlin2adpcm(data):
     if verbose:
-       print 'lin2adpcm'
+        print 'lin2adpcm'
     # Very cursory test
     if audioop.lin2adpcm('\0\0\0\0', 1, None) <> ('\0\0', (0,0)):
-       return 0
+        return 0
     return 1
 
 def testlin2ulaw(data):
     if verbose:
-       print 'lin2ulaw'
+        print 'lin2ulaw'
     if audioop.lin2ulaw(data[0], 1) <> '\377\347\333' or \
-             audioop.lin2ulaw(data[1], 2) <> '\377\377\377' or \
-             audioop.lin2ulaw(data[2], 4) <> '\377\377\377':
-       return 0
+              audioop.lin2ulaw(data[1], 2) <> '\377\377\377' or \
+              audioop.lin2ulaw(data[2], 4) <> '\377\377\377':
+        return 0
     return 1
 
 def testulaw2lin(data):
     if verbose:
-       print 'ulaw2lin'
+        print 'ulaw2lin'
     # Cursory
     d = audioop.lin2ulaw(data[0], 1)
     if audioop.ulaw2lin(d, 1) <> data[0]:
-       return 0
+        return 0
     return 1
 
 def testmul(data):
     if verbose:
-       print 'mul'
+        print 'mul'
     data2 = []
     for d in data:
-       str = ''
-       for s in d:
-           str = str + chr(ord(s)*2)
-       data2.append(str)
+        str = ''
+        for s in d:
+            str = str + chr(ord(s)*2)
+        data2.append(str)
     if audioop.mul(data[0], 1, 2) <> data2[0] or \
-             audioop.mul(data[1],2, 2) <> data2[1] or \
-             audioop.mul(data[2], 4, 2) <> data2[2]:
-       return 0
+              audioop.mul(data[1],2, 2) <> data2[1] or \
+              audioop.mul(data[2], 4, 2) <> data2[2]:
+        return 0
     return 1
 
 def testratecv(data):
@@ -181,75 +181,75 @@ def testratecv(data):
 
 def testreverse(data):
     if verbose:
-       print 'reverse'
+        print 'reverse'
     if audioop.reverse(data[0], 1) <> '\2\1\0':
-       return 0
+        return 0
     return 1
 
 def testtomono(data):
     if verbose:
-       print 'tomono'
+        print 'tomono'
     data2 = ''
     for d in data[0]:
-       data2 = data2 + d + d
+        data2 = data2 + d + d
     if audioop.tomono(data2, 1, 0.5, 0.5) <> data[0]:
-       return 0
+        return 0
     return 1
 
 def testtostereo(data):
     if verbose:
-       print 'tostereo'
+        print 'tostereo'
     data2 = ''
     for d in data[0]:
-       data2 = data2 + d + d
+        data2 = data2 + d + d
     if audioop.tostereo(data[0], 1, 1, 1) <> data2:
-       return 0
+        return 0
     return 1
 
 def testfindfactor(data):
     if verbose:
-       print 'findfactor'
+        print 'findfactor'
     if audioop.findfactor(data[1], data[1]) <> 1.0:
-       return 0
+        return 0
     return 1
 
 def testfindfit(data):
     if verbose:
-       print 'findfit'
+        print 'findfit'
     if audioop.findfit(data[1], data[1]) <> (0, 1.0):
-       return 0
+        return 0
     return 1
 
 def testfindmax(data):
     if verbose:
-       print 'findmax'
+        print 'findmax'
     if audioop.findmax(data[1], 1) <> 2:
-       return 0
+        return 0
     return 1
 
 def testgetsample(data):
     if verbose:
-       print 'getsample'
+        print 'getsample'
     for i in range(3):
-       if audioop.getsample(data[0], 1, i) <> i or \
-                 audioop.getsample(data[1], 2, i) <> i or \
-                 audioop.getsample(data[2], 4, i) <> i:
-           return 0
+        if audioop.getsample(data[0], 1, i) <> i or \
+                  audioop.getsample(data[1], 2, i) <> i or \
+                  audioop.getsample(data[2], 4, i) <> i:
+            return 0
     return 1
 
 def testone(name, data):
     try:
-       func = eval('test'+name)
+        func = eval('test'+name)
     except NameError:
-       print 'No test found for audioop.'+name+'()'
-       return
+        print 'No test found for audioop.'+name+'()'
+        return
     try:
-       rv = func(data)
+        rv = func(data)
     except 'xx':
-       print 'Test FAILED for audioop.'+name+'() (with an exception)'
-       return
+        print 'Test FAILED for audioop.'+name+'() (with an exception)'
+        return
     if not rv:
-       print 'Test FAILED for audioop.'+name+'()'
+        print 'Test FAILED for audioop.'+name+'()'
 
 def testall():
     data = [gendata1(), gendata2(), gendata4()]
@@ -257,8 +257,8 @@ def testall():
     # We know there is a routine 'add'
     routines = []
     for n in names:
-       if type(eval('audioop.'+n)) == type(audioop.add):
-           routines.append(n)
+        if type(eval('audioop.'+n)) == type(audioop.add):
+            routines.append(n)
     for n in routines:
-       testone(n, data)
+        testone(n, data)
 testall()
index aa156d966fa39df210752616006f37a99c54e4ef..fe3843d88f8655fe87d33f11ec109f376664b726 100755 (executable)
@@ -11,11 +11,11 @@ from test_support import verbose
 def test():
 
     try:
-       fname1 = tempfile.mktemp()
-       fname2 = tempfile.mktemp()
-       f = open(fname1, 'w')
+        fname1 = tempfile.mktemp()
+        fname2 = tempfile.mktemp()
+        f = open(fname1, 'w')
     except:
-       raise ImportError, "Cannot test binascii without a temp file"
+        raise ImportError, "Cannot test binascii without a temp file"
 
     start = 'Jack is my hero'
     f.write(start)
@@ -23,24 +23,24 @@ def test():
     
     binhex.binhex(fname1, fname2)
     if verbose:
-       print 'binhex'
+        print 'binhex'
 
     binhex.hexbin(fname2, fname1)
     if verbose:
-       print 'hexbin'
+        print 'hexbin'
 
     f = open(fname1, 'r')
     finish = f.readline()
 
     if start <> finish:
-       print 'Error: binhex <> hexbin'
+        print 'Error: binhex <> hexbin'
     elif verbose:
-       print 'binhex == hexbin'
+        print 'binhex == hexbin'
 
     try:
-       import os
-       os.unlink(fname1)
-       os.unlink(fname2)
+        import os
+        os.unlink(fname1)
+        os.unlink(fname2)
     except:
-       pass
+        pass
 test()
index aa156d966fa39df210752616006f37a99c54e4ef..fe3843d88f8655fe87d33f11ec109f376664b726 100755 (executable)
@@ -11,11 +11,11 @@ from test_support import verbose
 def test():
 
     try:
-       fname1 = tempfile.mktemp()
-       fname2 = tempfile.mktemp()
-       f = open(fname1, 'w')
+        fname1 = tempfile.mktemp()
+        fname2 = tempfile.mktemp()
+        f = open(fname1, 'w')
     except:
-       raise ImportError, "Cannot test binascii without a temp file"
+        raise ImportError, "Cannot test binascii without a temp file"
 
     start = 'Jack is my hero'
     f.write(start)
@@ -23,24 +23,24 @@ def test():
     
     binhex.binhex(fname1, fname2)
     if verbose:
-       print 'binhex'
+        print 'binhex'
 
     binhex.hexbin(fname2, fname1)
     if verbose:
-       print 'hexbin'
+        print 'hexbin'
 
     f = open(fname1, 'r')
     finish = f.readline()
 
     if start <> finish:
-       print 'Error: binhex <> hexbin'
+        print 'Error: binhex <> hexbin'
     elif verbose:
-       print 'binhex == hexbin'
+        print 'binhex == hexbin'
 
     try:
-       import os
-       os.unlink(fname1)
-       os.unlink(fname2)
+        import os
+        os.unlink(fname1)
+        os.unlink(fname2)
     except:
-       pass
+        pass
 test()
index 7a95eb9636f2be3e7d3ef34b79d11073fb61b8dc..1188e0612759bc9e4bcf99da8b3fbd188cd3c3a2 100755 (executable)
@@ -9,12 +9,12 @@ from test_support import verbose
 def test(openmethod, what):
 
     if verbose:
-       print '\nTesting: ', what
-       
+        print '\nTesting: ', what
+        
     fname = tempfile.mktemp()
     f = openmethod(fname, 'c')
     if verbose:
-       print 'creation...'
+        print 'creation...'
     f['0'] = ''
     f['a'] = 'Guido'
     f['b'] = 'van'
@@ -22,47 +22,47 @@ def test(openmethod, what):
     f['d'] = 'invented'
     f['f'] = 'Python'
     if verbose:
-       print '%s %s %s' % (f['a'], f['b'], f['c'])
+        print '%s %s %s' % (f['a'], f['b'], f['c'])
 
     if what == 'BTree' :
-       if verbose:
-           print 'key ordering...'
-       f.set_location(f.first()[0])
-       while 1:
-           try:
-               rec = f.next()
-           except KeyError:
-               if rec <> f.last():
-                   print 'Error, last <> last!'
-               f.previous()
-               break
-           if verbose:
-               print rec
-       if not f.has_key('a'):
-           print 'Error, missing key!'
+        if verbose:
+            print 'key ordering...'
+        f.set_location(f.first()[0])
+        while 1:
+            try:
+                rec = f.next()
+            except KeyError:
+                if rec <> f.last():
+                    print 'Error, last <> last!'
+                f.previous()
+                break
+            if verbose:
+                print rec
+        if not f.has_key('a'):
+            print 'Error, missing key!'
 
     f.sync()
     f.close()
     if verbose:
-       print 'modification...'
+        print 'modification...'
     f = openmethod(fname, 'w')
     f['d'] = 'discovered'
 
     if verbose:
-       print 'access...'
+        print 'access...'
     for key in f.keys():
-       word = f[key]
-       if verbose:
-           print word
+        word = f[key]
+        if verbose:
+            print word
 
     f.close()
 
 types = [(bsddb.btopen, 'BTree'),
-        (bsddb.hashopen, 'Hash Table'),
-        # (bsddb.rnopen,'Record Numbers'), 'put' for RECNO for bsddb 1.85
+         (bsddb.hashopen, 'Hash Table'),
+         # (bsddb.rnopen,'Record Numbers'), 'put' for RECNO for bsddb 1.85
          #                                   appears broken... at least on
-        #                                   Solaris Intel - rmasse 1/97
-        ]
+         #                                   Solaris Intel - rmasse 1/97
+         ]
 
 for type in types:
     test(type[0], type[1])
index aa51d57f9f11330ce25e7fe00e1dc2f73528c588..4d5615842c0d1c55ed59dadf9d6692d2883c2af7 100755 (executable)
@@ -6,8 +6,8 @@ import cd
 from test_support import verbose
 
 cdattrs = ['BLOCKSIZE', 'CDROM', 'DATASIZE', 'ERROR', 'NODISC', 'PAUSED', 'PLAYING', 'READY',
-          'STILL', '__doc__', '__name__', 'atime', 'audio', 'catalog', 'control', 'createparser', 'error',
-          'ident', 'index', 'msftoframe', 'open', 'pnum', 'ptime']
+           'STILL', '__doc__', '__name__', 'atime', 'audio', 'catalog', 'control', 'createparser', 'error',
+           'ident', 'index', 'msftoframe', 'open', 'pnum', 'ptime']
 
 
 # This is a very inobstrusive test for the existance of the cd module and all it's
@@ -17,10 +17,10 @@ cdattrs = ['BLOCKSIZE', 'CDROM', 'DATASIZE', 'ERROR', 'NODISC', 'PAUSED', 'PLAYI
 def main():
     # touch all the attributes of cd without doing anything
     if verbose:
-       print 'Touching cd module attributes...'
+        print 'Touching cd module attributes...'
     for attr in cdattrs:
-       if verbose:
-           print 'touching: ', attr
-       getattr(cd, attr)
+        if verbose:
+            print 'touching: ', attr
+        getattr(cd, attr)
 
 main()
index f32efa69d2578242f124579611b8bf8d6da7abf7..60fbc4353bad519114d1144289e1b5a9232ac113 100755 (executable)
@@ -69,10 +69,10 @@ clattrs = ['ADDED_ALGORITHM_ERROR', 'ALAW', 'ALGORITHM_ID',
 def main():
     # touch all the attributes of al without doing anything
     if verbose:
-       print 'Touching cl module attributes...'
+        print 'Touching cl module attributes...'
     for attr in clattrs:
-       if verbose:
-           print 'touching: ', attr
-       getattr(cl, attr)
+        if verbose:
+            print 'touching: ', attr
+        getattr(cl, attr)
 
 main()
index 71e77290c0f9e21119e0a72a0467beec77a516ad..509c739ea0dd119beca8eedd0363d14f23408b80 100755 (executable)
@@ -6,27 +6,27 @@ import cmath
 from test_support import verbose
 
 testdict = {'acos' : 1.0,
-           'acosh' : 1.0,
-           'asin' : 1.0,
-           'asinh' : 1.0,
-           'atan' : 0.2,
-           'atanh' : 0.2,
-           'cos' : 1.0,
-           'cosh' : 1.0,
-           'exp' : 1.0,
-           'log' : 1.0,
-           'log10' : 1.0,
-           'sin' : 1.0,
-           'sinh' : 1.0,
-           'sqrt' : 1.0,
-           'tan' : 1.0,
-           'tanh' : 1.0}
+            'acosh' : 1.0,
+            'asin' : 1.0,
+            'asinh' : 1.0,
+            'atan' : 0.2,
+            'atanh' : 0.2,
+            'cos' : 1.0,
+            'cosh' : 1.0,
+            'exp' : 1.0,
+            'log' : 1.0,
+            'log10' : 1.0,
+            'sin' : 1.0,
+            'sinh' : 1.0,
+            'sqrt' : 1.0,
+            'tan' : 1.0,
+            'tanh' : 1.0}
 
 for func in testdict.keys():
     f = getattr(cmath, func)
     r = f(testdict[func])
     if verbose:
-       print 'Calling %s(%f) = %f' % (func, testdict[func], abs(r))
+        print 'Calling %s(%f) = %f' % (func, testdict[func], abs(r))
 
 p = cmath.pi
 e = cmath.e
index 45f5f3764bd5d5bd3c78d3a25d1e4b58f265bcad..b4f7f89464f0b32abf69a2113373b3a642027b48 100755 (executable)
@@ -14,8 +14,8 @@ d['12345678910'] = '019237410982340912840198242'
 d.keys()
 if d.has_key('a'):
     if verbose:
-       print 'Test dbm keys: ', d.keys()
-       
+        print 'Test dbm keys: ', d.keys()
+        
 d.close()
 d = dbm.open(filename, 'r')
 d.close()
index 029196da4b7006646a1d6fb4718cafcc64dfc584..e7902cc5e06533b8bbd6bd9def645c9f99e1f805 100755 (executable)
@@ -12,20 +12,20 @@ sharedlibs = [
 
 for s, func in sharedlibs:
     try:
-       if verbose:
-           print 'trying to open:', s,
-       l = dl.open(s)
+        if verbose:
+            print 'trying to open:', s,
+        l = dl.open(s)
     except dl.error:
-       if verbose:
-           print 'failed'
-       pass
+        if verbose:
+            print 'failed'
+        pass
     else:
-       if verbose:
-           print 'succeeded...',
-       l.call(func)
-       l.close()
-       if verbose:
-           print 'worked!'
-       break
+        if verbose:
+            print 'succeeded...',
+        l.call(func)
+        l.close()
+        if verbose:
+            print 'worked!'
+        break
 else:
     print 'Could not open any shared libraries'
index 7228fdf65ececf00bce414f462c5afb8a28a5072..cb1e729f8ec0aa36245df0d8c1106c4a581ea507 100755 (executable)
@@ -7,31 +7,31 @@ import errno
 from test_support import verbose
 
 errors = ['E2BIG', 'EACCES', 'EADDRINUSE', 'EADDRNOTAVAIL', 'EADV',
-         'EAFNOSUPPORT', 'EAGAIN', 'EALREADY', 'EBADE', 'EBADF',
-         'EBADFD', 'EBADMSG', 'EBADR', 'EBADRQC', 'EBADSLT',
-         'EBFONT', 'EBUSY', 'ECHILD', 'ECHRNG', 'ECOMM',
-         'ECONNABORTED', 'ECONNREFUSED', 'ECONNRESET',
-         'EDEADLK', 'EDEADLOCK', 'EDESTADDRREQ', 'EDOM',
-         'EDQUOT', 'EEXIST', 'EFAULT', 'EFBIG', 'EHOSTDOWN',
-         'EHOSTUNREACH', 'EIDRM', 'EILSEQ', 'EINPROGRESS',
-         'EINTR', 'EINVAL', 'EIO', 'EISCONN', 'EISDIR',
-         'EL2HLT', 'EL2NSYNC', 'EL3HLT', 'EL3RST', 'ELIBACC',
-         'ELIBBAD', 'ELIBEXEC', 'ELIBMAX', 'ELIBSCN', 'ELNRNG',
-         'ELOOP', 'EMFILE', 'EMLINK', 'EMSGSIZE', 'EMULTIHOP',
-         'ENAMETOOLONG', 'ENETDOWN', 'ENETRESET', 'ENETUNREACH',
-         'ENFILE', 'ENOANO', 'ENOBUFS', 'ENOCSI', 'ENODATA',
-         'ENODEV', 'ENOENT', 'ENOEXEC', 'ENOLCK', 'ENOLINK',
-         'ENOMEM', 'ENOMSG', 'ENONET', 'ENOPKG', 'ENOPROTOOPT',
-         'ENOSPC', 'ENOSR', 'ENOSTR', 'ENOSYS', 'ENOTBLK',
-         'ENOTCONN', 'ENOTDIR', 'ENOTEMPTY', 'ENOTOBACCO', 'ENOTSOCK',
-         'ENOTTY', 'ENOTUNIQ', 'ENXIO', 'EOPNOTSUPP',
-         'EOVERFLOW', 'EPERM', 'EPFNOSUPPORT', 'EPIPE',
-         'EPROTO', 'EPROTONOSUPPORT', 'EPROTOTYPE',
-         'ERANGE', 'EREMCHG', 'EREMOTE', 'ERESTART',
-         'EROFS', 'ESHUTDOWN', 'ESOCKTNOSUPPORT', 'ESPIPE',
-         'ESRCH', 'ESRMNT', 'ESTALE', 'ESTRPIPE', 'ETIME',
-         'ETIMEDOUT', 'ETOOMANYREFS', 'ETXTBSY', 'EUNATCH',
-         'EUSERS', 'EWOULDBLOCK', 'EXDEV', 'EXFULL']
+          'EAFNOSUPPORT', 'EAGAIN', 'EALREADY', 'EBADE', 'EBADF',
+          'EBADFD', 'EBADMSG', 'EBADR', 'EBADRQC', 'EBADSLT',
+          'EBFONT', 'EBUSY', 'ECHILD', 'ECHRNG', 'ECOMM',
+          'ECONNABORTED', 'ECONNREFUSED', 'ECONNRESET',
+          'EDEADLK', 'EDEADLOCK', 'EDESTADDRREQ', 'EDOM',
+          'EDQUOT', 'EEXIST', 'EFAULT', 'EFBIG', 'EHOSTDOWN',
+          'EHOSTUNREACH', 'EIDRM', 'EILSEQ', 'EINPROGRESS',
+          'EINTR', 'EINVAL', 'EIO', 'EISCONN', 'EISDIR',
+          'EL2HLT', 'EL2NSYNC', 'EL3HLT', 'EL3RST', 'ELIBACC',
+          'ELIBBAD', 'ELIBEXEC', 'ELIBMAX', 'ELIBSCN', 'ELNRNG',
+          'ELOOP', 'EMFILE', 'EMLINK', 'EMSGSIZE', 'EMULTIHOP',
+          'ENAMETOOLONG', 'ENETDOWN', 'ENETRESET', 'ENETUNREACH',
+          'ENFILE', 'ENOANO', 'ENOBUFS', 'ENOCSI', 'ENODATA',
+          'ENODEV', 'ENOENT', 'ENOEXEC', 'ENOLCK', 'ENOLINK',
+          'ENOMEM', 'ENOMSG', 'ENONET', 'ENOPKG', 'ENOPROTOOPT',
+          'ENOSPC', 'ENOSR', 'ENOSTR', 'ENOSYS', 'ENOTBLK',
+          'ENOTCONN', 'ENOTDIR', 'ENOTEMPTY', 'ENOTOBACCO', 'ENOTSOCK',
+          'ENOTTY', 'ENOTUNIQ', 'ENXIO', 'EOPNOTSUPP',
+          'EOVERFLOW', 'EPERM', 'EPFNOSUPPORT', 'EPIPE',
+          'EPROTO', 'EPROTONOSUPPORT', 'EPROTOTYPE',
+          'ERANGE', 'EREMCHG', 'EREMOTE', 'ERESTART',
+          'EROFS', 'ESHUTDOWN', 'ESOCKTNOSUPPORT', 'ESPIPE',
+          'ESRCH', 'ESRMNT', 'ESTALE', 'ESTRPIPE', 'ETIME',
+          'ETIMEDOUT', 'ETOOMANYREFS', 'ETXTBSY', 'EUNATCH',
+          'EUSERS', 'EWOULDBLOCK', 'EXDEV', 'EXFULL']
 
 #
 # This is is a wee bit bogus since the module only conditionally adds
@@ -40,10 +40,10 @@ errors = ['E2BIG', 'EACCES', 'EADDRINUSE', 'EADDRNOTAVAIL', 'EADV',
 #
 for error in errors:
     try:
-       a = getattr(errno, error)
+        a = getattr(errno, error)
     except AttributeError:
-       if verbose:
-           print '%s: not found' % error
+        if verbose:
+            print '%s: not found' % error
     else:
-       if verbose:
-           print '%s: %d' % (error, a)
+        if verbose:
+            print '%s: %d' % (error, a)
index dbcdbe809706d42d4cacdcfeea482b7acfd14715..9796ef4e695e4567ebddc04b7746d3ccc0e8bab1 100644 (file)
@@ -8,9 +8,9 @@ print '5. Built-in exceptions'
 
 def r(thing):
     if type(thing) == ClassType:
-       print thing.__name__
+        print thing.__name__
     else:
-       print thing
+        print thing
 
 r(AttributeError)
 import sys
@@ -24,14 +24,14 @@ fp.close()
 fp = open(TESTFN, 'r')
 savestdin = sys.stdin
 try:
-       try:
-               sys.stdin = fp
-               x = raw_input()
-       except EOFError:
-               pass
+        try:
+                sys.stdin = fp
+                x = raw_input()
+        except EOFError:
+                pass
 finally:
-       sys.stdin = savestdin
-       fp.close()
+        sys.stdin = savestdin
+        fp.close()
 
 r(IOError)
 try: open('this file does not exist', 'r')
@@ -64,7 +64,7 @@ except NameError: pass
 r(OverflowError)
 x = 1
 try:
-       while 1: x = x+x
+        while 1: x = x+x
 except OverflowError: pass
 
 r(RuntimeError)
index d4e4d28cc494861d1456bdacb22855929cc927e8..1010b6f87055cd154e597df10587ccae0e91dfb4 100755 (executable)
@@ -85,67 +85,67 @@ def main():
     # insure that we at least have an X display before continuing.
     import os
     try:
-       display = os.environ['DISPLAY']
+        display = os.environ['DISPLAY']
     except:
-       # Raise ImportError because regrtest.py handles it specially.
-       raise ImportError, "No $DISPLAY -- skipping gl test"
+        # Raise ImportError because regrtest.py handles it specially.
+        raise ImportError, "No $DISPLAY -- skipping gl test"
 
     # touch all the attributes of gl without doing anything
     if verbose:
-       print 'Touching gl module attributes...'
+        print 'Touching gl module attributes...'
     for attr in glattrs:
-       if verbose:
-           print 'touching: ', attr
-       getattr(gl, attr)
+        if verbose:
+            print 'touching: ', attr
+        getattr(gl, attr)
 
     # create a small 'Crisscross' window
     if verbose:
-       print 'Creating a small "CrissCross" window...'
-       print 'foreground'
+        print 'Creating a small "CrissCross" window...'
+        print 'foreground'
     gl.foreground()
     if verbose:
-       print 'prefposition'
+        print 'prefposition'
     gl.prefposition(500, 900, 500, 900)
     if verbose:
-       print 'winopen "CrissCross"'
+        print 'winopen "CrissCross"'
     w = gl.winopen('CrissCross')
     if verbose:
-       print 'clear'
+        print 'clear'
     gl.clear()
     if verbose:
-       print 'ortho2'
+        print 'ortho2'
     gl.ortho2(0.0, 400.0, 0.0, 400.0)
     if verbose:
-       print 'color WHITE'
+        print 'color WHITE'
     gl.color(GL.WHITE)
     if verbose:
-       print 'color RED'
+        print 'color RED'
     gl.color(GL.RED)
     if verbose:
-       print 'bgnline'
+        print 'bgnline'
     gl.bgnline()
     if verbose:
-       print 'v2f'
+        print 'v2f'
     gl.v2f(0.0, 0.0)
     gl.v2f(400.0, 400.0)
     if verbose:
-       print 'endline'
+        print 'endline'
     gl.endline()
     if verbose:
-       print 'bgnline'
+        print 'bgnline'
     gl.bgnline()
     if verbose:
-       print 'v2i'
+        print 'v2i'
     gl.v2i(400, 0)
     gl.v2i(0, 400)
     if verbose:
-       print 'endline'
+        print 'endline'
     gl.endline()
     if verbose:
-       print 'Displaying window for 2 seconds...'
+        print 'Displaying window for 2 seconds...'
     time.sleep(2)
     if verbose:
-       print 'winclose'
+        print 'winclose'
     gl.winclose(w)
     
 main()
index f39049feac362ac103234a2a9e96e0bf6c07d5b7..bfe3a76f27b56af8291202c2cb49a44498911bbb 100755 (executable)
@@ -10,16 +10,16 @@ groups = grp.getgrall()
 if verbose:
     print 'Groups:'
     for group in groups:
-       print group
+        print group
 
 if not groups:
     if verbose:
-       print "Empty Group Database -- no further tests of grp module possible"
+        print "Empty Group Database -- no further tests of grp module possible"
 else:
     group = grp.getgrgid(groups[0][2])
     if verbose:
-       print 'Group Entry for GID %d: %s' % (groups[0][2], group)
+        print 'Group Entry for GID %d: %s' % (groups[0][2], group)
 
     group = grp.getgrnam(groups[0][0])
     if verbose:
-       print 'Group Entry for group %s: %s' % (groups[0][0], group)
+        print 'Group Entry for group %s: %s' % (groups[0][0], group)
index 89b111cf2ba0e259ea933a071bde5c52e3a6a33f..63ab13819fa0be246c93f970d152c5a8214e3418 100755 (executable)
@@ -15,14 +15,14 @@ def main(use_rgbimg=1):
     uu.decode(get_qualified_path('testrgb.uue'), 'test.rgb')
 
     if use_rgbimg:
-       image, width, height = getrgbimage('test.rgb')
+        image, width, height = getrgbimage('test.rgb')
     else:
-       image, width, height = getimage('test.rgb')
-       
+        image, width, height = getimage('test.rgb')
+        
     # Return the selected part of image, which should by width by height
     # in size and consist of pixels of psize bytes.
     if verbose:
-       print 'crop'
+        print 'crop'
     newimage = imageop.crop (image, 4, width, height, 0, 0, 1, 1)
 
     # Return image scaled to size newwidth by newheight. No interpolation
@@ -30,7 +30,7 @@ def main(use_rgbimg=1):
     # Therefore, computer-generated images or dithered images will
     # not look nice after scaling. 
     if verbose:
-       print 'scale'
+        print 'scale'
     scaleimage = imageop.scale(image, 4, width, height, 1, 1)
 
     # Run a vertical low-pass filter over an image. It does so by computing
@@ -38,34 +38,34 @@ def main(use_rgbimg=1):
     # pixels. The main use of this routine is to forestall excessive flicker
     # if the image two vertically-aligned source pixels,  hence the name. 
     if verbose:
-       print 'tovideo'
+        print 'tovideo'
     videoimage = imageop.tovideo (image, 4, width, height)
 
     # Convert an rgb image to an 8 bit rgb
     if verbose:
-       print 'rgb2rgb8'
+        print 'rgb2rgb8'
     greyimage = imageop.rgb2rgb8(image, width, height)
 
     # Convert an 8 bit rgb image to a 24 bit rgb image
     if verbose:
-       print 'rgb82rgb'
+        print 'rgb82rgb'
     image = imageop.rgb82rgb(greyimage, width, height)
     
     # Convert an rgb image to an 8 bit greyscale image
     if verbose:
-       print 'rgb2grey'
+        print 'rgb2grey'
     greyimage = imageop.rgb2grey(image, width, height)
 
     # Convert an 8 bit greyscale image to a 24 bit rgb image
     if verbose:
-       print 'grey2rgb'
+        print 'grey2rgb'
     image = imageop.grey2rgb(greyimage, width, height)
     
     # Convert a 8-bit deep greyscale image to a 1-bit deep image by
     # tresholding all the pixels. The resulting image is tightly packed
     # and is probably only useful as an argument to mono2grey. 
     if verbose:
-       print 'grey2mono'
+        print 'grey2mono'
     monoimage = imageop.grey2mono (greyimage, width, height, 0) 
 
     # monoimage, width, height = getimage('monotest.rgb')
@@ -75,42 +75,42 @@ def main(use_rgbimg=1):
     # monochrome  black-and-white image to greyscale pass the values 0 and
     # 255 respectively.
     if verbose:
-       print 'mono2grey'
+        print 'mono2grey'
     greyimage = imageop.mono2grey (monoimage, width, height, 0, 255)
 
     # Convert an 8-bit greyscale image to a 1-bit monochrome image using a
     # (simple-minded) dithering algorithm.
     if verbose:
-       print 'dither2mono'
+        print 'dither2mono'
     monoimage = imageop.dither2mono (greyimage, width, height)
 
     # Convert an 8-bit greyscale image to a 4-bit greyscale image without
     # dithering. 
     if verbose:
-       print 'grey2grey4'
+        print 'grey2grey4'
     grey4image = imageop.grey2grey4 (greyimage, width, height) 
 
     # Convert an 8-bit greyscale image to a 2-bit greyscale image without
     # dithering. 
     if verbose:
-       print 'grey2grey2'
+        print 'grey2grey2'
     grey2image = imageop.grey2grey2 (greyimage, width, height) 
 
     # Convert an 8-bit greyscale image to a 2-bit greyscale image with
     # dithering. As for dither2mono, the dithering algorithm is currently
     # very simple. 
     if verbose:
-       print 'dither2grey2'
+        print 'dither2grey2'
     grey2image = imageop.dither2grey2 (greyimage, width, height) 
 
     # Convert a 4-bit greyscale image to an 8-bit greyscale image. 
     if verbose:
-       print 'grey42grey'
+        print 'grey42grey'
     greyimage = imageop.grey42grey (grey4image, width, height) 
 
     # Convert a 2-bit greyscale image to an 8-bit greyscale image. 
     if verbose:
-       print 'grey22grey'
+        print 'grey22grey'
     image = imageop.grey22grey (grey2image, width, height)
 
     # Cleanup
@@ -123,12 +123,12 @@ def getrgbimage(name):
     import rgbimg
 
     try:
-       sizes = rgbimg.sizeofimage(name)
+        sizes = rgbimg.sizeofimage(name)
     except rgbimg.error:
-       name = get_qualified_path(name)
-       sizes = rgbimg.sizeofimage(name)
+        name = get_qualified_path(name)
+        sizes = rgbimg.sizeofimage(name)
     if verbose:
-       print 'rgbimg opening test image: %s, sizes: %s' % (name, str(sizes))
+        print 'rgbimg opening test image: %s, sizes: %s' % (name, str(sizes))
 
     image = rgbimg.longimagedata(name)
     return (image, sizes[0], sizes[1])
@@ -141,12 +141,12 @@ def getimage(name):
     import imgfile
   
     try:
-       sizes = imgfile.getsizes(name)
+        sizes = imgfile.getsizes(name)
     except imgfile.error:
-       name = get_qualified_path(name)
-       sizes = imgfile.getsizes(name)
+        name = get_qualified_path(name)
+        sizes = imgfile.getsizes(name)
     if verbose:
-       print 'imgfile opening test image: %s, sizes: %s' % (name, str(sizes))
+        print 'imgfile opening test image: %s, sizes: %s' % (name, str(sizes))
 
     image = imgfile.read(name)
     return (image, sizes[0], sizes[1])
@@ -157,13 +157,13 @@ def get_qualified_path(name):
     import os
     path = sys.path
     try:
-       path = [os.path.dirname(__file__)] + path
+        path = [os.path.dirname(__file__)] + path
     except NameError:
-       pass
+        pass
     for dir in path:
-       fullname = os.path.join(dir, name)
-       if os.path.exists(fullname):
-           return fullname
+        fullname = os.path.join(dir, name)
+        if os.path.exists(fullname):
+            return fullname
     return name
 
 # rgbimg (unlike imgfile) is portable to platforms other than SGI.
index 576a51c6ab227148b87a3bbbbed05e0ccad5e16f..aa9c414da564705894db449822eff806cbc22d64 100755 (executable)
@@ -24,12 +24,12 @@ def main():
     unlink('greytest.rgb')
 
 def findfile(file):
-       if os.path.isabs(file): return file
-       import sys
-       for dn in sys.path:
-               fn = os.path.join(dn, file)
-               if os.path.exists(fn): return fn
-       return file
+        if os.path.isabs(file): return file
+        import sys
+        for dn in sys.path:
+                fn = os.path.join(dn, file)
+                if os.path.exists(fn): return fn
+        return file
 
 def testimage(name):
     """Run through the imgfile's battery of possible methods
@@ -44,23 +44,23 @@ def testimage(name):
 
     # try opening the name directly
     try:
-       # This function returns a tuple (x, y, z) where x and y are the size
-       # of the image in pixels and z is the number of bytes per pixel. Only
-       # 3 byte RGB pixels and 1 byte greyscale pixels are supported.
-       sizes = imgfile.getsizes(name)
+        # This function returns a tuple (x, y, z) where x and y are the size
+        # of the image in pixels and z is the number of bytes per pixel. Only
+        # 3 byte RGB pixels and 1 byte greyscale pixels are supported.
+        sizes = imgfile.getsizes(name)
     except imgfile.error:
-       # get a more qualified path component of the script...
-       if __name__ == '__main__':
-           ourname = sys.argv[0]
-       else: # ...or the full path of the module
-           ourname = sys.modules[__name__].__file__
-
-       parts = string.splitfields(ourname, os.sep)
-       parts[-1] = name
-       name = string.joinfields(parts, os.sep)
-       sizes = imgfile.getsizes(name)
+        # get a more qualified path component of the script...
+        if __name__ == '__main__':
+            ourname = sys.argv[0]
+        else: # ...or the full path of the module
+            ourname = sys.modules[__name__].__file__
+
+        parts = string.splitfields(ourname, os.sep)
+        parts[-1] = name
+        name = string.joinfields(parts, os.sep)
+        sizes = imgfile.getsizes(name)
     if verbose:
-       print 'Opening test image: %s, sizes: %s' % (name, str(sizes))
+        print 'Opening test image: %s, sizes: %s' % (name, str(sizes))
     # This function reads and decodes the image on the specified file,
     # and returns it as a python string. The string has either 1 byte
     # greyscale pixels or 4 byte RGBA pixels. The bottom left pixel
@@ -74,12 +74,12 @@ def testimage(name):
     # are stored as 4 byte values of which only the lower three
     # bytes are used). These are the formats returned by gl.lrectread. 
     if verbose:
-       print 'Writing output file'
+        print 'Writing output file'
     imgfile.write (outputfile, image, sizes[0], sizes[1], sizes[2]) 
    
 
     if verbose:
-       print 'Opening scaled test image: %s, sizes: %s' % (name, str(sizes))
+        print 'Opening scaled test image: %s, sizes: %s' % (name, str(sizes))
     # This function is identical to read but it returns an image that
     # is scaled to the given x and y sizes. If the filter and blur
     # parameters are omitted scaling is done by simply dropping
@@ -93,7 +93,7 @@ def testimage(name):
     # makes no attempt to keep the aspect ratio correct, so that
     # is the users' responsibility.
     if verbose:
-       print 'Filtering with "impulse"'
+        print 'Filtering with "impulse"'
     simage = imgfile.readscaled (name, sizes[0]/2, sizes[1]/2, 'impulse', 2.0)
 
     # This function sets a global flag which defines whether the
@@ -101,14 +101,14 @@ def testimage(name):
     # top (flag is zero, compatible with SGI GL) or from top to
     # bottom(flag is one, compatible with X). The default is zero. 
     if verbose:
-       print 'Switching to X compatibility'
+        print 'Switching to X compatibility'
     imgfile.ttob (1) 
 
     if verbose:
-       print 'Filtering with "triangle"'
+        print 'Filtering with "triangle"'
     simage = imgfile.readscaled (name, sizes[0]/2, sizes[1]/2, 'triangle', 3.0)
     if verbose:
-       print 'Switching back to SGI compatibility'
+        print 'Switching back to SGI compatibility'
     imgfile.ttob (0) 
     
     if verbose: print 'Filtering with "quadratic"'
@@ -117,7 +117,7 @@ def testimage(name):
     simage = imgfile.readscaled (name, sizes[0]/2, sizes[1]/2, 'gaussian', 1.0)
 
     if verbose:
-       print 'Writing output file'
+        print 'Writing output file'
     imgfile.write (outputfile, simage, sizes[0]/2, sizes[1]/2, sizes[2]) 
 
     os.unlink(outputfile)
index b1e2ae72ac411fac0f6a2489cb2f5492895c7ca3..a693d8b87b883efb2b63f280f1061bff429bef33 100644 (file)
@@ -4,7 +4,7 @@ import new
 
 class Eggs:
     def get_yolks(self):
-       return self.yolks
+        return self.yolks
 
 print 'new.module()'
 m = new.module('Spam')
index 0d345fe5c2ca974c03a266bcf6377201a4ce0f92..b28a6722d2bce8214b31b24b814c5d3ab995847c 100644 (file)
@@ -11,19 +11,19 @@ except nis.error, msg:
 done = 0
 for nismap in maps:
     if verbose:
-       print nismap
+        print nismap
     mapping = nis.cat(nismap)
     for k, v in mapping.items():
-       if verbose:
-           print '    ', k, v
-       if not k:
-           continue
-       if nis.match(k, nismap) <> v:
-           print "NIS match failed for key `%s' in map `%s'" % (k, nismap)
-       else:
-           # just test the one key, otherwise this test could take a
-           # very long time
-           done = 1
-           break
+        if verbose:
+            print '    ', k, v
+        if not k:
+            continue
+        if nis.match(k, nismap) <> v:
+            print "NIS match failed for key `%s' in map `%s'" % (k, nismap)
+        else:
+            # just test the one key, otherwise this test could take a
+            # very long time
+            done = 1
+            break
     if done:
-       break
+        break
index 15c9dda5cb796bda3e00dba5d2e52d2b93f6ce9f..bdace26a472b4d64901d3c8fdbb28527f4b011b4 100644 (file)
@@ -9,18 +9,18 @@ print 'XXX Not yet fully implemented'
 print '2.1 try inside for loop'
 n = 0
 for i in range(10):
-       n = n+i
-       try: 1/0
-       except NameError: pass
-       except ZeroDivisionError: pass
-       except TypeError: pass
-       try: pass
-       except: pass
-       try: pass
-       finally: pass
-       n = n+i
+        n = n+i
+        try: 1/0
+        except NameError: pass
+        except ZeroDivisionError: pass
+        except TypeError: pass
+        try: pass
+        except: pass
+        try: pass
+        finally: pass
+        n = n+i
 if n <> 90:
-       raise TestFailed, 'try inside for'
+        raise TestFailed, 'try inside for'
 
 
 print '2.2 raise class exceptions'
@@ -30,7 +30,7 @@ class BClass(AClass): pass
 class CClass: pass
 class DClass(AClass):
     def __init__(self, ignore):
-       pass
+        pass
 
 try: raise AClass()
 except: pass
@@ -50,12 +50,12 @@ b = BClass()
 
 try: raise AClass, b
 except BClass, v:
-       if v != b: raise TestFailed
+        if v != b: raise TestFailed
 else: raise TestFailed
 
 try: raise b
 except AClass, v:
-       if v != b: raise TestFailed
+        if v != b: raise TestFailed
 
 # not enough arguments
 try:  raise BClass, a
@@ -64,7 +64,7 @@ except TypeError: pass
 try:  raise DClass, a
 except DClass, v:
     if not isinstance(v, DClass):
-       raise TestFailed
+        raise TestFailed
 
 print '2.3 comparing function objects'
 
index ff4cba057649f020464476b66631c17afdb4b138..8d3864c50d95e3d4e817221e66f644f9bb7fda3c 100644 (file)
@@ -6,11 +6,11 @@ def test(name, input, output, *args):
     f = getattr(operator, name)
     params = (input,) + args
     try:
-       val = apply(f, params)
+        val = apply(f, params)
     except:
-       val = sys.exc_type
+        val = sys.exc_type
     if val <> output:
-       print '%s%s = %s: %s expected' % (f.__name__, params, `val`, `output`)
+        print '%s%s = %s: %s expected' % (f.__name__, params, `val`, `output`)
 
 test('abs', -1, 1)
 test('add', 3, 7, 4)
index dc5b567cd29dafdfdd9c91904832001bf31e6cdd..aa0d3f035d6051b1dec160f11d0d525a36843373 100644 (file)
@@ -1,7 +1,7 @@
 # Test packages (dotted-name import)
 
 import sys, os, string, tempfile, traceback
-from os import mkdir, rmdir            # Can't test if these fail
+from os import mkdir, rmdir             # Can't test if these fail
 del mkdir, rmdir
 from test_support import verbose
 
@@ -10,19 +10,19 @@ from test_support import verbose
 def mkhier(root, descr):
     mkdir(root)
     for name, contents in descr:
-       comps = string.split(name)
-       fullname = root
-       for c in comps:
-           fullname = os.path.join(fullname, c)
-       if contents is None:
-           mkdir(fullname)
-       else:
-           if verbose: print "write", fullname
-           f = open(fullname, "w")
-           f.write(contents)
-           if contents and contents[-1] != '\n':
-               f.write('\n')
-           f.close()
+        comps = string.split(name)
+        fullname = root
+        for c in comps:
+            fullname = os.path.join(fullname, c)
+        if contents is None:
+            mkdir(fullname)
+        else:
+            if verbose: print "write", fullname
+            f = open(fullname, "w")
+            f.write(contents)
+            if contents and contents[-1] != '\n':
+                f.write('\n')
+            f.close()
 
 def mkdir(x):
     if verbose: print "mkdir", x
@@ -31,11 +31,11 @@ def mkdir(x):
 def cleanout(root):
     names = os.listdir(root)
     for name in names:
-       fullname = os.path.join(root, name)
-       if os.path.isdir(fullname) and not os.path.islink(fullname):
-           cleanout(fullname)
-       else:
-           os.remove(fullname)
+        fullname = os.path.join(root, name)
+        if os.path.isdir(fullname) and not os.path.islink(fullname):
+            cleanout(fullname)
+        else:
+            os.remove(fullname)
     rmdir(root)
 
 def rmdir(x):
@@ -53,19 +53,19 @@ def runtest(hier, code):
     f.write(code)
     f.close()
     try:
-       sys.path.insert(0, root)
-       if verbose: print "sys.path =", sys.path
-       try:
-           execfile(codefile, globals(), {})
-       except:
-           traceback.print_exc(file=sys.stdout)
+        sys.path.insert(0, root)
+        if verbose: print "sys.path =", sys.path
+        try:
+            execfile(codefile, globals(), {})
+        except:
+            traceback.print_exc(file=sys.stdout)
     finally:
-       sys.path[:] = savepath
-       try:
-           cleanout(root)
-       except (os.error, IOError):
-           pass
-       os.remove(codefile)
+        sys.path[:] = savepath
+        try:
+            cleanout(root)
+        except (os.error, IOError):
+            pass
+        os.remove(codefile)
 
 # Test descriptions
 
@@ -203,12 +203,12 @@ args = []
 if __name__ == '__main__':
     args = sys.argv[1:]
     if args and args[0] == '-q':
-       verbose = 0
-       del args[0]
+        verbose = 0
+        del args[0]
 
 for name, hier, code in tests:
     if args and name not in args:
-       print "skipping test", name
-       continue
+        print "skipping test", name
+        continue
     print "running test", name
     runtest(hier, code)
index fc6725391e1a1e4ae7fafd6b895973d96c143ac4..ec17d53add664ee85ff312886c0d11f800d88d88 100644 (file)
@@ -13,16 +13,16 @@ def powtest(type):
                 raise ValueError, 'pow(0,'+str(i)+') != 0'
             if (pow(type(1),1)!=type(1)):
                 raise ValueError, 'pow(1,'+str(i)+') != 1'
-           
+            
         for i in range(-100, 100):
             if (pow(type(i),3)!=i*i*i):
                 raise ValueError, 'pow('+str(i)+',3) != '+str(i*i*i)
     
         pow2=1
         for i in range(0,31):
-           if (pow(2,i)!=pow2):
+            if (pow(2,i)!=pow2):
                 raise ValueError, 'pow(2,'+str(i)+') != '+str(pow2)
-           if (i!=30): pow2=pow2*2
+            if (i!=30): pow2=pow2*2
 
     print "    Testing 3-argument pow() function..."
     il, ih = -20, 20
@@ -31,7 +31,7 @@ def powtest(type):
     compare = cmp
     if (type==float):
         il=1
-       compare = test_support.fcmp
+        compare = test_support.fcmp
     elif (type==int):
         jl=0
     elif (type==long):
@@ -39,11 +39,11 @@ def powtest(type):
     for i in range(il, ih+1):
          for j in range(jl,jh+1):
              for k in range(kl, kh+1):
-                if (k!=0):
-                    if compare(pow(type(i),j,k), pow(type(i),j)% type(k)):
+                 if (k!=0):
+                     if compare(pow(type(i),j,k), pow(type(i),j)% type(k)):
                          raise ValueError, "pow(" +str(i)+ "," +str(j)+ \
-                             "," +str(k)+ ") != pow(" +str(i)+ "," + \
-                             str(j)+ ") % " +str(k)
+                              "," +str(k)+ ") != pow(" +str(i)+ "," + \
+                              str(j)+ ") % " +str(k)
 
 
 print 'Testing integer mode...'
index d9006861b62e7e8046efbc87603e0ed53f59cba0..79bf866994c11ad4078e972232cd7e9003294482 100644 (file)
@@ -9,17 +9,17 @@ for e in entries:
     name = e[0]
     uid = e[2]
     if verbose:
-       print name, uid
+        print name, uid
     print 'pwd.getpwuid()'
     dbuid = pwd.getpwuid(uid)
     if dbuid[0] <> name:
-       print 'Mismatch in pwd.getpwuid()'
+        print 'Mismatch in pwd.getpwuid()'
     print 'pwd.getpwnam()'
     dbname = pwd.getpwnam(name)
     if dbname[2] <> uid:
-       print 'Mismatch in pwd.getpwnam()'
+        print 'Mismatch in pwd.getpwnam()'
     else:
-       print 'name matches uid'
+        print 'name matches uid'
     break
 
 # try to get some errors
@@ -35,21 +35,21 @@ fakename = allnames[namei]
 while bynames.has_key(fakename):
     chars = map(None, fakename)
     for i in range(len(chars)):
-       if chars[i] == 'z':
-           chars[i] = 'A'
-           break
-       elif chars[i] == 'Z':
-           continue
-       else:
-           chars[i] = chr(ord(chars[i]) + 1)
-           break
+        if chars[i] == 'z':
+            chars[i] = 'A'
+            break
+        elif chars[i] == 'Z':
+            continue
+        else:
+            chars[i] = chr(ord(chars[i]) + 1)
+            break
     else:
-       namei = namei + 1
-       try:
-           fakename = allnames[namei]
-       except IndexError:
-           # should never happen... if so, just forget it
-           break
+        namei = namei + 1
+        try:
+            fakename = allnames[namei]
+        except IndexError:
+            # should never happen... if so, just forget it
+            break
     fakename = string.join(map(None, chars), '')
     
 try:
index b47c1059f8d4a4675e328afe5ed77f2b8942081d..ffb5c669bf4451991410597fc5c0b412c6cd9dc6 100644 (file)
@@ -15,8 +15,8 @@ try:
     assert re.sub("(?i)b+", "x", "bbbb BBBB") == 'x x'
     
     def bump_num(matchobj):
-       int_value = int(matchobj.group(0))
-       return str(int_value + 1)
+        int_value = int(matchobj.group(0))
+        return str(int_value + 1)
 
     assert re.sub(r'\d+', bump_num, '08.2 -2 23x99y') == '9.3 -3 24x100y'
     
@@ -151,9 +151,9 @@ except AssertionError:
 
 for flags in [re.I, re.M, re.X, re.S, re.L]:
     try:
-       r = re.compile('^pattern$', flags)
+        r = re.compile('^pattern$', flags)
     except:
-       print 'Exception raised on flag', flags
+        print 'Exception raised on flag', flags
 
 from re_tests import *
 if verbose:
@@ -166,86 +166,86 @@ for t in tests:
     sys.stdout.flush()
     pattern=s=outcome=repl=expected=None
     if len(t)==5:
-       pattern, s, outcome, repl, expected = t
+        pattern, s, outcome, repl, expected = t
     elif len(t)==3:
-       pattern, s, outcome = t 
+        pattern, s, outcome = t 
     else:
-       raise ValueError, ('Test tuples should have 3 or 5 fields',t)
+        raise ValueError, ('Test tuples should have 3 or 5 fields',t)
 
     try:
-       obj=re.compile(pattern)
+        obj=re.compile(pattern)
     except re.error:
-       if outcome==SYNTAX_ERROR: pass  # Expected a syntax error
-       else: 
-           print '=== Syntax error:', t
+        if outcome==SYNTAX_ERROR: pass  # Expected a syntax error
+        else: 
+            print '=== Syntax error:', t
     except KeyboardInterrupt: raise KeyboardInterrupt
     except:
-       print '*** Unexpected error ***'
-       if verbose:
-           traceback.print_exc(file=sys.stdout)
+        print '*** Unexpected error ***'
+        if verbose:
+            traceback.print_exc(file=sys.stdout)
     else:
-       try:
-           result=obj.search(s)
-       except (re.error), msg:
-           print '=== Unexpected exception', t, repr(msg)
-       if outcome==SYNTAX_ERROR:
-           # This should have been a syntax error; forget it.
-           pass
-       elif outcome==FAIL:
-           if result is None: pass   # No match, as expected
-           else: print '=== Succeeded incorrectly', t
-       elif outcome==SUCCEED:
-           if result is not None:
-               # Matched, as expected, so now we compute the
-               # result string and compare it to our expected result.
-               start, end = result.span(0)
-               vardict={'found': result.group(0),
-                        'groups': result.group(),
-                        'flags': result.re.flags}
-               for i in range(1, 100):
-                   try:
-                       gi = result.group(i)
-                       # Special hack because else the string concat fails:
-                       if gi is None:
-                           gi = "None"
-                   except IndexError:
-                       gi = "Error"
-                   vardict['g%d' % i] = gi
-               for i in result.re.groupindex.keys():
-                   try:
-                       gi = result.group(i)
-                       if gi is None:
-                           gi = "None"
-                   except IndexError:
-                       gi = "Error"
-                   vardict[i] = gi
-               repl=eval(repl, vardict)
-               if repl!=expected:
-                   print '=== grouping error', t,
-                   print repr(repl)+' should be '+repr(expected)
-           else:
-               print '=== Failed incorrectly', t
-
-           # Try the match with the search area limited to the extent
-           # of the match and see if it still succeeds.  \B will
-           # break (because it won't match at the end or start of a
-           # string), so we'll ignore patterns that feature it.
-           
-           if pattern[:2]!='\\B' and pattern[-2:]!='\\B':
-               obj=re.compile(pattern)
-               result=obj.search(s, pos=result.start(0), endpos=result.end(0)+1)
-               if result==None:
-                   print '=== Failed on range-limited match', t
+        try:
+            result=obj.search(s)
+        except (re.error), msg:
+            print '=== Unexpected exception', t, repr(msg)
+        if outcome==SYNTAX_ERROR:
+            # This should have been a syntax error; forget it.
+            pass
+        elif outcome==FAIL:
+            if result is None: pass   # No match, as expected
+            else: print '=== Succeeded incorrectly', t
+        elif outcome==SUCCEED:
+            if result is not None:
+                # Matched, as expected, so now we compute the
+                # result string and compare it to our expected result.
+                start, end = result.span(0)
+                vardict={'found': result.group(0),
+                         'groups': result.group(),
+                         'flags': result.re.flags}
+                for i in range(1, 100):
+                    try:
+                        gi = result.group(i)
+                        # Special hack because else the string concat fails:
+                        if gi is None:
+                            gi = "None"
+                    except IndexError:
+                        gi = "Error"
+                    vardict['g%d' % i] = gi
+                for i in result.re.groupindex.keys():
+                    try:
+                        gi = result.group(i)
+                        if gi is None:
+                            gi = "None"
+                    except IndexError:
+                        gi = "Error"
+                    vardict[i] = gi
+                repl=eval(repl, vardict)
+                if repl!=expected:
+                    print '=== grouping error', t,
+                    print repr(repl)+' should be '+repr(expected)
+            else:
+                print '=== Failed incorrectly', t
+
+            # Try the match with the search area limited to the extent
+            # of the match and see if it still succeeds.  \B will
+            # break (because it won't match at the end or start of a
+            # string), so we'll ignore patterns that feature it.
+            
+            if pattern[:2]!='\\B' and pattern[-2:]!='\\B':
+                obj=re.compile(pattern)
+                result=obj.search(s, pos=result.start(0), endpos=result.end(0)+1)
+                if result==None:
+                    print '=== Failed on range-limited match', t
 
             # Try the match with IGNORECASE enabled, and check that it
-           # still succeeds.
+            # still succeeds.
             obj=re.compile(pattern, re.IGNORECASE)
             result=obj.search(s)
             if result==None:
                 print '=== Fails on case-insensitive match', t
 
             # Try the match with LOCALE enabled, and check that it
-           # still succeeds.
+            # still succeeds.
             obj=re.compile(pattern, re.LOCALE)
             result=obj.search(s)
             if result==None:
index 4be60264193f1a603e9c1fba5fc3ee4579a71d58..6a7f01b266900cd6bc28b0f387e86658afcb49d6 100644 (file)
@@ -67,44 +67,44 @@ if verbose: print 'Running regex_tests test suite'
 for t in tests:
     pattern=s=outcome=repl=expected=None
     if len(t)==5:
-       pattern, s, outcome, repl, expected = t
+        pattern, s, outcome, repl, expected = t
     elif len(t)==3:
-       pattern, s, outcome = t 
+        pattern, s, outcome = t 
     else:
-       raise ValueError, ('Test tuples should have 3 or 5 fields',t)
+        raise ValueError, ('Test tuples should have 3 or 5 fields',t)
 
     try:
-       obj=regex.compile(pattern)
+        obj=regex.compile(pattern)
     except regex.error:
-       if outcome==SYNTAX_ERROR: pass    # Expected a syntax error
-       else: 
-           # Regex syntax errors aren't yet reported, so for 
-           # the official test suite they'll be quietly ignored.
-           pass
-           #print '=== Syntax error:', t
+        if outcome==SYNTAX_ERROR: pass    # Expected a syntax error
+        else: 
+            # Regex syntax errors aren't yet reported, so for 
+            # the official test suite they'll be quietly ignored.
+            pass
+            #print '=== Syntax error:', t
     else:
-       try:
-           result=obj.search(s)
-       except regex.error, msg:
-           print '=== Unexpected exception', t, repr(msg)
-       if outcome==SYNTAX_ERROR:
-           # This should have been a syntax error; forget it.
-           pass
-       elif outcome==FAIL:
-           if result==-1: pass   # No match, as expected
-           else: print '=== Succeeded incorrectly', t
-       elif outcome==SUCCEED:
-           if result!=-1:
-               # Matched, as expected, so now we compute the
-               # result string and compare it to our expected result.
-               start, end = obj.regs[0]
-               found=s[start:end]
-               groups=obj.group(1,2,3,4,5,6,7,8,9,10)
-               vardict=vars()
-               for i in range(len(groups)):
-                   vardict['g'+str(i+1)]=str(groups[i])
-               repl=eval(repl)
-               if repl!=expected:
-                   print '=== grouping error', t, repr(repl)+' should be '+repr(expected)
-           else:
-               print '=== Failed incorrectly', t
+        try:
+            result=obj.search(s)
+        except regex.error, msg:
+            print '=== Unexpected exception', t, repr(msg)
+        if outcome==SYNTAX_ERROR:
+            # This should have been a syntax error; forget it.
+            pass
+        elif outcome==FAIL:
+            if result==-1: pass   # No match, as expected
+            else: print '=== Succeeded incorrectly', t
+        elif outcome==SUCCEED:
+            if result!=-1:
+                # Matched, as expected, so now we compute the
+                # result string and compare it to our expected result.
+                start, end = obj.regs[0]
+                found=s[start:end]
+                groups=obj.group(1,2,3,4,5,6,7,8,9,10)
+                vardict=vars()
+                for i in range(len(groups)):
+                    vardict['g'+str(i+1)]=str(groups[i])
+                repl=eval(repl)
+                if repl!=expected:
+                    print '=== grouping error', t, repr(repl)+' should be '+repr(expected)
+            else:
+                print '=== Failed incorrectly', t
index c5b7c83b005a88d6df2f4fcf31e8db201acd7269..0c449dac76e2ba93b8fd0c72b924aff808e21995 100644 (file)
@@ -9,32 +9,32 @@ error = 'test_rgbimg.error'
 print 'RGBimg test suite:'
 
 def findfile(file):
-       if os.path.isabs(file): return file
-       import sys
-       path = sys.path
-       try:
-           path = [os.path.dirname(__file__)] + path
-       except NameError:
-           pass
-       for dn in path:
-               fn = os.path.join(dn, file)
-               if os.path.exists(fn): return fn
-       return file
+        if os.path.isabs(file): return file
+        import sys
+        path = sys.path
+        try:
+            path = [os.path.dirname(__file__)] + path
+        except NameError:
+            pass
+        for dn in path:
+                fn = os.path.join(dn, file)
+                if os.path.exists(fn): return fn
+        return file
 
 def testimg(rgb_file, raw_file):
-       rgb_file = findfile(rgb_file)
-       raw_file = findfile(raw_file)
-       width, height = rgbimg.sizeofimage(rgb_file)
-       rgb = rgbimg.longimagedata(rgb_file)
-       if len(rgb) != width * height * 4:
-               raise error, 'bad image length'
-       raw = open(raw_file, 'rb').read()
-       if rgb != raw:
-               raise error, \
-                     'images don\'t match for '+rgb_file+' and '+raw_file
-       for depth in [1, 3, 4]:
-               rgbimg.longstoimage(rgb, width, height, depth, '@.rgb')
-       os.unlink('@.rgb')
+        rgb_file = findfile(rgb_file)
+        raw_file = findfile(raw_file)
+        width, height = rgbimg.sizeofimage(rgb_file)
+        rgb = rgbimg.longimagedata(rgb_file)
+        if len(rgb) != width * height * 4:
+                raise error, 'bad image length'
+        raw = open(raw_file, 'rb').read()
+        if rgb != raw:
+                raise error, \
+                      'images don\'t match for '+rgb_file+' and '+raw_file
+        for depth in [1, 3, 4]:
+                rgbimg.longstoimage(rgb, width, height, depth, '@.rgb')
+        os.unlink('@.rgb')
 
 table = [
     ('testrgb.uue', 'test.rgb'),
@@ -45,7 +45,7 @@ for source, target in table:
     source = findfile(source)
     target = findfile(target)
     if verbose:
-       print "uudecoding", source, "->", target, "..."
+        print "uudecoding", source, "->", target, "..."
     uu.decode(source, target)
 
 if verbose:
@@ -53,23 +53,23 @@ if verbose:
 
 ttob = rgbimg.ttob(0)
 if ttob != 0:
-       raise error, 'ttob should start out as zero'
+        raise error, 'ttob should start out as zero'
 
 testimg('test.rgb', 'test.rawimg')
 
 ttob = rgbimg.ttob(1)
 if ttob != 0:
-       raise error, 'ttob should be zero'
+        raise error, 'ttob should be zero'
 
 testimg('test.rgb', 'test.rawimg.rev')
 
 ttob = rgbimg.ttob(0)
 if ttob != 1:
-       raise error, 'ttob should be one'
+        raise error, 'ttob should be one'
 
 ttob = rgbimg.ttob(0)
 if ttob != 0:
-       raise error, 'ttob should be zero'
+        raise error, 'ttob should be zero'
 
 for source, target in table:
     unlink(findfile(target))
index 53185b1a303b877da689030a2b6817ca9e472d81..60de3600bc214c003b7c9c7648e259b591f03091 100644 (file)
@@ -16,7 +16,7 @@ class Nope:
 
 class Almost:
     def fileno(self):
-       return 'fileno'
+        return 'fileno'
     
 try:
     rfd, wfd, xfd = select.select([Nope()], [], [])
@@ -34,31 +34,31 @@ else:
 
 
 def test():
-       import sys
-       if sys.platform[:3] in ('win', 'mac', 'os2'):
-               if verbose:
-                       print "Can't test select easily on", sys.platform
-               return
-       cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 1; done'
-       p = os.popen(cmd, 'r')
-       for tout in (0, 1, 2, 4, 8, 16) + (None,)*10:
-               if verbose:
-                       print 'timeout =', tout
-               rfd, wfd, xfd = select.select([p], [], [], tout)
-##             print rfd, wfd, xfd
-               if (rfd, wfd, xfd) == ([], [], []):
-                       continue
-               if (rfd, wfd, xfd) == ([p], [], []):
-                       line = p.readline()
-                       if verbose:
-                               print `line`
-                       if not line:
-                               if verbose:
-                                       print 'EOF'
-                               break
-                       continue
-               print 'Heh?'
-       p.close()
+        import sys
+        if sys.platform[:3] in ('win', 'mac', 'os2'):
+                if verbose:
+                        print "Can't test select easily on", sys.platform
+                return
+        cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 1; done'
+        p = os.popen(cmd, 'r')
+        for tout in (0, 1, 2, 4, 8, 16) + (None,)*10:
+                if verbose:
+                        print 'timeout =', tout
+                rfd, wfd, xfd = select.select([p], [], [], tout)
+##              print rfd, wfd, xfd
+                if (rfd, wfd, xfd) == ([], [], []):
+                        continue
+                if (rfd, wfd, xfd) == ([p], [], []):
+                        line = p.readline()
+                        if verbose:
+                                print `line`
+                        if not line:
+                                if verbose:
+                                        print 'EOF'
+                                break
+                        continue
+                print 'Heh?'
+        p.close()
 
 test()
 
index b602c91d65fb5e757bc6b0a2429c594c12a3d70a..772b86ba83ff62564f1a3668d716966ef257b5b7 100644 (file)
@@ -1,11 +1,11 @@
 # Not tested:
-#      socket.fromfd()
-#      sktobj.getsockopt()
-#      sktobj.recvfrom()
-#      sktobj.sendto()
-#      sktobj.setblocking()
-#      sktobj.setsockopt()
-#      sktobj.shutdown()
+#       socket.fromfd()
+#       sktobj.getsockopt()
+#       sktobj.recvfrom()
+#       sktobj.sendto()
+#       sktobj.setblocking()
+#       sktobj.setsockopt()
+#       sktobj.shutdown()
 
 
 from test_support import verbose, TestFailed
@@ -16,9 +16,9 @@ import string
 
 def missing_ok(str):
     try:
-       getattr(socket, str)
+        getattr(socket, str)
     except AttributeError:
-       pass
+        pass
 
 try: raise socket.error
 except socket.error: print "socket.error"
@@ -33,37 +33,37 @@ socket.SOCK_SEQPACKET
 
 for optional in ("AF_UNIX",
 
-                "SO_DEBUG", "SO_ACCEPTCONN", "SO_REUSEADDR", "SO_KEEPALIVE",
-                "SO_DONTROUTE", "SO_BROADCAST", "SO_USELOOPBACK", "SO_LINGER",
-                "SO_OOBINLINE", "SO_REUSEPORT", "SO_SNDBUF", "SO_RCVBUF",
-                "SO_SNDLOWAT", "SO_RCVLOWAT", "SO_SNDTIMEO", "SO_RCVTIMEO",
-                "SO_ERROR", "SO_TYPE", "SOMAXCONN",
-
-                "MSG_OOB", "MSG_PEEK", "MSG_DONTROUTE", "MSG_EOR",
-                "MSG_TRUNC", "MSG_CTRUNC", "MSG_WAITALL", "MSG_BTAG",
-                "MSG_ETAG",
-
-                "SOL_SOCKET",
-
-                "IPPROTO_IP", "IPPROTO_ICMP", "IPPROTO_IGMP",
-                "IPPROTO_GGP", "IPPROTO_TCP", "IPPROTO_EGP",
-                "IPPROTO_PUP", "IPPROTO_UDP", "IPPROTO_IDP",
-                "IPPROTO_HELLO", "IPPROTO_ND", "IPPROTO_TP",
-                "IPPROTO_XTP", "IPPROTO_EON", "IPPROTO_BIP",
-                "IPPROTO_RAW", "IPPROTO_MAX",
-
-                "IPPORT_RESERVED", "IPPORT_USERRESERVED",
-
-                "INADDR_ANY", "INADDR_BROADCAST", "INADDR_LOOPBACK",
-                "INADDR_UNSPEC_GROUP", "INADDR_ALLHOSTS_GROUP",
-                "INADDR_MAX_LOCAL_GROUP", "INADDR_NONE",
-
-                "IP_OPTIONS", "IP_HDRINCL", "IP_TOS", "IP_TTL",
-                "IP_RECVOPTS", "IP_RECVRETOPTS", "IP_RECVDSTADDR",
-                "IP_RETOPTS", "IP_MULTICAST_IF", "IP_MULTICAST_TTL",
-                "IP_MULTICAST_LOOP", "IP_ADD_MEMBERSHIP",
-                "IP_DROP_MEMBERSHIP",
-                ):
+                 "SO_DEBUG", "SO_ACCEPTCONN", "SO_REUSEADDR", "SO_KEEPALIVE",
+                 "SO_DONTROUTE", "SO_BROADCAST", "SO_USELOOPBACK", "SO_LINGER",
+                 "SO_OOBINLINE", "SO_REUSEPORT", "SO_SNDBUF", "SO_RCVBUF",
+                 "SO_SNDLOWAT", "SO_RCVLOWAT", "SO_SNDTIMEO", "SO_RCVTIMEO",
+                 "SO_ERROR", "SO_TYPE", "SOMAXCONN",
+
+                 "MSG_OOB", "MSG_PEEK", "MSG_DONTROUTE", "MSG_EOR",
+                 "MSG_TRUNC", "MSG_CTRUNC", "MSG_WAITALL", "MSG_BTAG",
+                 "MSG_ETAG",
+
+                 "SOL_SOCKET",
+
+                 "IPPROTO_IP", "IPPROTO_ICMP", "IPPROTO_IGMP",
+                 "IPPROTO_GGP", "IPPROTO_TCP", "IPPROTO_EGP",
+                 "IPPROTO_PUP", "IPPROTO_UDP", "IPPROTO_IDP",
+                 "IPPROTO_HELLO", "IPPROTO_ND", "IPPROTO_TP",
+                 "IPPROTO_XTP", "IPPROTO_EON", "IPPROTO_BIP",
+                 "IPPROTO_RAW", "IPPROTO_MAX",
+
+                 "IPPORT_RESERVED", "IPPORT_USERRESERVED",
+
+                 "INADDR_ANY", "INADDR_BROADCAST", "INADDR_LOOPBACK",
+                 "INADDR_UNSPEC_GROUP", "INADDR_ALLHOSTS_GROUP",
+                 "INADDR_MAX_LOCAL_GROUP", "INADDR_NONE",
+
+                 "IP_OPTIONS", "IP_HDRINCL", "IP_TOS", "IP_TTL",
+                 "IP_RECVOPTS", "IP_RECVRETOPTS", "IP_RECVDSTADDR",
+                 "IP_RETOPTS", "IP_MULTICAST_IF", "IP_MULTICAST_TTL",
+                 "IP_MULTICAST_LOOP", "IP_ADD_MEMBERSHIP",
+                 "IP_DROP_MEMBERSHIP",
+                 ):
     missing_ok(optional)
 
 socktype = socket.SocketType
@@ -80,7 +80,7 @@ if verbose:
 
 for name in all_host_names:
     if string.find(name, '.'):
-       break
+        break
 else:
     print 'FQDN not found'
 
@@ -95,52 +95,52 @@ canfork = hasattr(os, 'fork')
 try:
     PORT = 50007
     if not canfork or os.fork():
-       # parent is server
-       s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-       s.bind(hostname, PORT)
-       s.listen(1)
-       if verbose:
-           print 'parent accepting'
-       if canfork:
-           conn, addr = s.accept()
-           if verbose:
-               print 'connected by', addr
-           # couple of interesting tests while we've got a live socket
-           f = conn.fileno()
-           if verbose:
-               print 'fileno:', f
-           p = conn.getpeername()
-           if verbose:
-               print 'peer:', p
-           n = conn.getsockname()
-           if verbose:
-               print 'sockname:', n
-           f = conn.makefile()
-           if verbose:
-               print 'file obj:', f
-           while 1:
-               data = conn.recv(1024)
-               if not data:
-                   break
-               if verbose:
-                   print 'received:', data
-               conn.send(data)
-           conn.close()
+        # parent is server
+        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+        s.bind(hostname, PORT)
+        s.listen(1)
+        if verbose:
+            print 'parent accepting'
+        if canfork:
+            conn, addr = s.accept()
+            if verbose:
+                print 'connected by', addr
+            # couple of interesting tests while we've got a live socket
+            f = conn.fileno()
+            if verbose:
+                print 'fileno:', f
+            p = conn.getpeername()
+            if verbose:
+                print 'peer:', p
+            n = conn.getsockname()
+            if verbose:
+                print 'sockname:', n
+            f = conn.makefile()
+            if verbose:
+                print 'file obj:', f
+            while 1:
+                data = conn.recv(1024)
+                if not data:
+                    break
+                if verbose:
+                    print 'received:', data
+                conn.send(data)
+            conn.close()
     else:
-       try:
-           # child is client
-           time.sleep(5)
-           s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-           if verbose:
-               print 'child connecting'
-           s.connect(hostname, PORT)
-           msg = 'socket test'
-           s.send(msg)
-           data = s.recv(1024)
-           if msg <> data:
-               print 'parent/client mismatch'
-           s.close()
-       finally:
-           os._exit(1)
+        try:
+            # child is client
+            time.sleep(5)
+            s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+            if verbose:
+                print 'child connecting'
+            s.connect(hostname, PORT)
+            msg = 'socket test'
+            s.send(msg)
+            data = s.recv(1024)
+            if msg <> data:
+                print 'parent/client mismatch'
+            s.close()
+        finally:
+            os._exit(1)
 except socket.error, msg:
     raise TestFailed, msg
index f1db8df88e138d9ae8e5a044d1b8c513f0a74000..7441a00553411667809c698fc3d21e3f5b46c0b9 100755 (executable)
@@ -13,12 +13,12 @@ def main():
     # Try a bunch of dates and times,  chosen to vary through time of
     # day and daylight saving time
     for j in range(-5, 5):
-       for i in range(25):
-           strftest(now + (i + j*100)*23*3603)
+        for i in range(25):
+            strftest(now + (i + j*100)*23*3603)
 
 def strftest(now):
     if verbose:
-       print "strftime test for", time.ctime(now)
+        print "strftime test for", time.ctime(now)
     nowsecs = str(long(now))[:-1]
     gmt = time.gmtime(now)
     now = time.localtime(now)
@@ -29,106 +29,106 @@ def strftest(now):
     jan1 = time.localtime(time.mktime((now[0], 1, 1) + (0,)*6))
 
     try:
-       if now[8]: tz = time.tzname[1]
-       else: tz = time.tzname[0]
+        if now[8]: tz = time.tzname[1]
+        else: tz = time.tzname[0]
     except AttributeError:
-       tz = ''
+        tz = ''
 
     if now[3] > 12: clock12 = now[3] - 12
     elif now[3] > 0: clock12 = now[3]
     else: clock12 = 12
 
     expectations = (
-       ('%a', calendar.day_abbr[now[6]], 'abbreviated weekday name'),
-       ('%A', calendar.day_name[now[6]], 'full weekday name'),
-       ('%b', calendar.month_abbr[now[1]], 'abbreviated month name'),
-       ('%B', calendar.month_name[now[1]], 'full month name'),
-       # %c see below
-       ('%d', '%02d' % now[2], 'day of month as number (00-31)'),
-       ('%H', '%02d' % now[3], 'hour (00-23)'),
-       ('%I', '%02d' % clock12, 'hour (01-12)'),
-       ('%j', '%03d' % now[7], 'julian day (001-366)'),
-       ('%m', '%02d' % now[1], 'month as number (01-12)'),
-       ('%M', '%02d' % now[4], 'minute, (00-59)'),
-       ('%p', ampm, 'AM or PM as appropriate'),
-       ('%S', '%02d' % now[5], 'seconds of current time (00-60)'),
-       ('%U', '%02d' % ((now[7] + jan1[6])/7),
-        'week number of the year (Sun 1st)'),
-       ('%w', '%d' % ((1+now[6]) % 7), 'weekday as a number (Sun 1st)'),
-       ('%W', '%02d' % ((now[7] + (jan1[6] - 1)%7)/7),
-        'week number of the year (Mon 1st)'),
-       # %x see below
-       ('%X', '%02d:%02d:%02d' % (now[3], now[4], now[5]), '%H:%M:%S'),
-       ('%y', '%02d' % (now[0]%100), 'year without century'),
-       ('%Y', '%d' % now[0], 'year with century'),
-       # %Z see below
-       ('%%', '%', 'single percent sign'),
-       )
+        ('%a', calendar.day_abbr[now[6]], 'abbreviated weekday name'),
+        ('%A', calendar.day_name[now[6]], 'full weekday name'),
+        ('%b', calendar.month_abbr[now[1]], 'abbreviated month name'),
+        ('%B', calendar.month_name[now[1]], 'full month name'),
+        # %c see below
+        ('%d', '%02d' % now[2], 'day of month as number (00-31)'),
+        ('%H', '%02d' % now[3], 'hour (00-23)'),
+        ('%I', '%02d' % clock12, 'hour (01-12)'),
+        ('%j', '%03d' % now[7], 'julian day (001-366)'),
+        ('%m', '%02d' % now[1], 'month as number (01-12)'),
+        ('%M', '%02d' % now[4], 'minute, (00-59)'),
+        ('%p', ampm, 'AM or PM as appropriate'),
+        ('%S', '%02d' % now[5], 'seconds of current time (00-60)'),
+        ('%U', '%02d' % ((now[7] + jan1[6])/7),
+         'week number of the year (Sun 1st)'),
+        ('%w', '%d' % ((1+now[6]) % 7), 'weekday as a number (Sun 1st)'),
+        ('%W', '%02d' % ((now[7] + (jan1[6] - 1)%7)/7),
+         'week number of the year (Mon 1st)'),
+        # %x see below
+        ('%X', '%02d:%02d:%02d' % (now[3], now[4], now[5]), '%H:%M:%S'),
+        ('%y', '%02d' % (now[0]%100), 'year without century'),
+        ('%Y', '%d' % now[0], 'year with century'),
+        # %Z see below
+        ('%%', '%', 'single percent sign'),
+        )
 
     nonstandard_expectations = (
-       # These are standard but don't have predictable output
-       ('%c', fixasctime(time.asctime(now)), 'near-asctime() format'),
-       ('%x', '%02d/%02d/%02d' % (now[1], now[2], (now[0]%100)),
-        '%m/%d/%y %H:%M:%S'),
-       ('(%Z)', '(%s)' % tz, 'time zone name'),
-
-       # These are some platform specific extensions
-       ('%D', '%02d/%02d/%02d' % (now[1], now[2], (now[0]%100)), 'mm/dd/yy'),
-       ('%e', '%2d' % now[2], 'day of month as number, blank padded ( 0-31)'),
-       ('%h', calendar.month_abbr[now[1]], 'abbreviated month name'),
-       ('%k', '%2d' % now[3], 'hour, blank padded ( 0-23)'),
-       ('%n', '\n', 'newline character'),
-       ('%r', '%02d:%02d:%02d %s' % (clock12, now[4], now[5], ampm),
-        '%I:%M:%S %p'),
-       ('%R', '%02d:%02d' % (now[3], now[4]), '%H:%M'),
-       ('%s', nowsecs, 'seconds since the Epoch in UCT'),
-       ('%t', '\t', 'tab character'),
-       ('%T', '%02d:%02d:%02d' % (now[3], now[4], now[5]), '%H:%M:%S'),
-       ('%3y', '%03d' % (now[0]%100),
-        'year without century rendered using fieldwidth'),
-       )
+        # These are standard but don't have predictable output
+        ('%c', fixasctime(time.asctime(now)), 'near-asctime() format'),
+        ('%x', '%02d/%02d/%02d' % (now[1], now[2], (now[0]%100)),
+         '%m/%d/%y %H:%M:%S'),
+        ('(%Z)', '(%s)' % tz, 'time zone name'),
+
+        # These are some platform specific extensions
+        ('%D', '%02d/%02d/%02d' % (now[1], now[2], (now[0]%100)), 'mm/dd/yy'),
+        ('%e', '%2d' % now[2], 'day of month as number, blank padded ( 0-31)'),
+        ('%h', calendar.month_abbr[now[1]], 'abbreviated month name'),
+        ('%k', '%2d' % now[3], 'hour, blank padded ( 0-23)'),
+        ('%n', '\n', 'newline character'),
+        ('%r', '%02d:%02d:%02d %s' % (clock12, now[4], now[5], ampm),
+         '%I:%M:%S %p'),
+        ('%R', '%02d:%02d' % (now[3], now[4]), '%H:%M'),
+        ('%s', nowsecs, 'seconds since the Epoch in UCT'),
+        ('%t', '\t', 'tab character'),
+        ('%T', '%02d:%02d:%02d' % (now[3], now[4], now[5]), '%H:%M:%S'),
+        ('%3y', '%03d' % (now[0]%100),
+         'year without century rendered using fieldwidth'),
+        )
 
     if verbose:
-       print "Strftime test, platform: %s, Python version: %s" % \
-             (sys.platform, string.split(sys.version)[0])
+        print "Strftime test, platform: %s, Python version: %s" % \
+              (sys.platform, string.split(sys.version)[0])
 
     for e in expectations:
-       try:
-           result = time.strftime(e[0], now)
-       except ValueError, error:
-           print "Standard '%s' format gave error:" % e[0], error
-           continue
-       if result == e[1]: continue
-       if result[0] == '%':
-           print "Does not support standard '%s' format (%s)" % (e[0], e[2])
-       else:
-           print "Conflict for %s (%s):" % (e[0], e[2])
-           print "  Expected %s, but got %s" % (e[1], result)
+        try:
+            result = time.strftime(e[0], now)
+        except ValueError, error:
+            print "Standard '%s' format gave error:" % e[0], error
+            continue
+        if result == e[1]: continue
+        if result[0] == '%':
+            print "Does not support standard '%s' format (%s)" % (e[0], e[2])
+        else:
+            print "Conflict for %s (%s):" % (e[0], e[2])
+            print "  Expected %s, but got %s" % (e[1], result)
 
     for e in nonstandard_expectations:
-       try:
-           result = time.strftime(e[0], now)
-       except ValueError, result:
-           if verbose:
-               print "Error for nonstandard '%s' format (%s): %s" % \
-                     (e[0], e[2], str(result))
-           continue
-       if result == e[1]:
-           if verbose:
-               print "Supports nonstandard '%s' format (%s)" % (e[0], e[2])
-       elif result[0] == '%':
-           if verbose:
-               print "Does not appear to support '%s' format (%s)" % (e[0],
-                                                                      e[2])
-       else:
-           if verbose:
-               print "Conflict for nonstandard '%s' format (%s):" % (e[0],
-                                                                     e[2])
-               print "  Expected %s, but got %s" % (e[1], result)
+        try:
+            result = time.strftime(e[0], now)
+        except ValueError, result:
+            if verbose:
+                print "Error for nonstandard '%s' format (%s): %s" % \
+                      (e[0], e[2], str(result))
+            continue
+        if result == e[1]:
+            if verbose:
+                print "Supports nonstandard '%s' format (%s)" % (e[0], e[2])
+        elif result[0] == '%':
+            if verbose:
+                print "Does not appear to support '%s' format (%s)" % (e[0],
+                                                                       e[2])
+        else:
+            if verbose:
+                print "Conflict for nonstandard '%s' format (%s):" % (e[0],
+                                                                      e[2])
+                print "  Expected %s, but got %s" % (e[1], result)
 
 def fixasctime(s):
     if s[8] == ' ':
-       s = s[:8] + '0' + s[9:]
+        s = s[:8] + '0' + s[9:]
     return s
 
 main()
index a4f18828e7430febd687c712ee3aa8df698ac56b..bd31058fa5cd2d699051aa9f11c52ef40832c394 100644 (file)
@@ -3,19 +3,19 @@ import strop, sys
 
 def test(name, input, output, *args):
     if verbose:
-       print 'string.%s%s =? %s... ' % (name, (input,) + args, output),
+        print 'string.%s%s =? %s... ' % (name, (input,) + args, output),
     f = getattr(strop, name)
     try:
-       value = apply(f, (input,) + args)
+        value = apply(f, (input,) + args)
     except:
-        value = sys.exc_type
+         value = sys.exc_type
     if value != output:
-       if verbose:
-           print 'no'
-       print f, `input`, `output`, `value`
+        if verbose:
+            print 'no'
+        print f, `input`, `output`, `value`
     else:
-       if verbose:
-           print 'yes'
+        if verbose:
+            print 'yes'
 
 test('atoi', " 1 ", 1)
 test('atoi', " 1x", ValueError)
index c1e7b9ea3b86cb0229cafb3230d49a506e37645b..2c599d720bbddfc314c1071da4baa11a1c750983 100644 (file)
@@ -4,13 +4,13 @@ import struct
 
 def simple_err(func, *args):
     try:
-       apply(func, args)
+        apply(func, args)
     except struct.error:
-       pass
+        pass
     else:
-       raise TestFailed, "%s%s did not raise struct.error" % (
-           func.__name__, args)
-##     pdb.set_trace()
+        raise TestFailed, "%s%s did not raise struct.error" % (
+            func.__name__, args)
+##      pdb.set_trace()
 
 simple_err(struct.calcsize, 'Q')
 
@@ -24,7 +24,7 @@ sz = struct.calcsize(fmt)
 sz3 = struct.calcsize(fmt3)
 if sz * 3 <> sz3:
     raise TestFailed, 'inconsistent sizes (3*%s -> 3*%d = %d, %s -> %d)' % (
-       `fmt`, sz, 3*sz, `fmt3`, sz3)
+        `fmt`, sz, 3*sz, `fmt3`, sz3)
 
 simple_err(struct.pack, 'iii', 3)
 simple_err(struct.pack, 'i', 3, 3, 3)
@@ -44,16 +44,16 @@ d = 3.1415
 
 for prefix in ('', '@', '<', '>', '=', '!'):
     for format in ('xcbhilfd', 'xcBHILfd'):
-       format = prefix + format
-       if verbose:
-           print "trying:", format
-       s = struct.pack(format, c, b, h, i, l, f, d)
-       cp, bp, hp, ip, lp, fp, dp = struct.unpack(format, s)
-       if (cp <> c or bp <> b or hp <> h or ip <> i or lp <> l or
-           int(100 * fp) <> int(100 * f) or int(100 * dp) <> int(100 * d)):
-           # ^^^ calculate only to two decimal places
-           raise TestFailed, "unpack/pack not transitive (%s, %s)" % (
-               str(format), str((cp, bp, hp, ip, lp, fp, dp)))
+        format = prefix + format
+        if verbose:
+            print "trying:", format
+        s = struct.pack(format, c, b, h, i, l, f, d)
+        cp, bp, hp, ip, lp, fp, dp = struct.unpack(format, s)
+        if (cp <> c or bp <> b or hp <> h or ip <> i or lp <> l or
+            int(100 * fp) <> int(100 * f) or int(100 * dp) <> int(100 * d)):
+            # ^^^ calculate only to two decimal places
+            raise TestFailed, "unpack/pack not transitive (%s, %s)" % (
+                str(format), str((cp, bp, hp, ip, lp, fp, dp)))
 
 # Test some of the new features in detail
 
@@ -98,24 +98,24 @@ def badpack(fmt, arg, got, exp):
 
 def badunpack(fmt, arg, got, exp):
     return "unpack(%s, %s) -> (%s,) # expected (%s,)" % (
-       `fmt`, `arg`, `got`, `exp`)
+        `fmt`, `arg`, `got`, `exp`)
 
 isbigendian = struct.pack('=h', 1) == '\0\1'
 
 for fmt, arg, big, lil, asy in tests:
     if verbose:
-       print `fmt`, `arg`, `big`, `lil`
+        print `fmt`, `arg`, `big`, `lil`
     for (xfmt, exp) in [('>'+fmt, big), ('!'+fmt, big), ('<'+fmt, lil),
-                       ('='+fmt, isbigendian and big or lil)]:
-       res = struct.pack(xfmt, arg)
-       if res != exp:
-           raise TestFailed, "pack(%s, %s) -> %s # expected %s" % (
-               `fmt`, `arg`, `res`, `exp`)
-       n = struct.calcsize(xfmt)
-       if n != len(res):
-           raise TestFailed, "calcsize(%s) -> %d # expected %d" % (
-               `xfmt`, n, len(res))
-       rev = struct.unpack(xfmt, res)[0]
-       if rev != arg and not asy:
-           raise TestFailed, "unpack(%s, %s) -> (%s,) # expected (%s,)" % (
-               `fmt`, `res`, `rev`, `arg`)
+                        ('='+fmt, isbigendian and big or lil)]:
+        res = struct.pack(xfmt, arg)
+        if res != exp:
+            raise TestFailed, "pack(%s, %s) -> %s # expected %s" % (
+                `fmt`, `arg`, `res`, `exp`)
+        n = struct.calcsize(xfmt)
+        if n != len(res):
+            raise TestFailed, "calcsize(%s) -> %d # expected %d" % (
+                `xfmt`, n, len(res))
+        rev = struct.unpack(xfmt, res)[0]
+        if rev != arg and not asy:
+            raise TestFailed, "unpack(%s, %s) -> (%s,) # expected (%s,)" % (
+                `fmt`, `res`, `rev`, `arg`)
index 7e9d1b1e17635dad93269b9bf73e9b671fd700b4..1438c095bfefe64370cf95955705958cdb141617 100644 (file)
@@ -3,29 +3,29 @@ import sunaudiodev
 import os
 
 def findfile(file):
-       if os.path.isabs(file): return file
-       import sys
-       path = sys.path
-       try:
-               path = [os.path.dirname(__file__)] + path
-       except NameError:
-               pass
-       for dn in path:
-               fn = os.path.join(dn, file)
-               if os.path.exists(fn): return fn
-       return file
+        if os.path.isabs(file): return file
+        import sys
+        path = sys.path
+        try:
+                path = [os.path.dirname(__file__)] + path
+        except NameError:
+                pass
+        for dn in path:
+                fn = os.path.join(dn, file)
+                if os.path.exists(fn): return fn
+        return file
 
 def play_sound_file(path):
     fp = open(path, 'r')
     data = fp.read()
     fp.close()
     try:
-       a = sunaudiodev.open('w')
+        a = sunaudiodev.open('w')
     except sunaudiodev.error, msg:
-       raise TestFailed, msg
+        raise TestFailed, msg
     else:
-       a.write(data)
-       a.close()
+        a.write(data)
+        a.close()
 
 def test():
     play_sound_file(findfile('audiotest.au'))
index cfa18a393e259fd3762218adb7d4628720b39ed4..03d081eb99d3e0b2c11d93c878a468274a446c80 100644 (file)
@@ -14,13 +14,13 @@ if long(time.mktime(time.localtime(t))) <> long(t):
 time.sleep(1.2)
 tt = time.gmtime(t)
 for directive in ('a', 'A', 'b', 'B', 'c', 'd', 'H', 'I',
-                 'j', 'm', 'M', 'p', 'S',
-                 'U', 'w', 'W', 'x', 'X', 'y', 'Y', 'Z', '%'):
+                  'j', 'm', 'M', 'p', 'S',
+                  'U', 'w', 'W', 'x', 'X', 'y', 'Y', 'Z', '%'):
     format = ' %' + directive
     try:
-       time.strftime(format, tt)
+        time.strftime(format, tt)
     except ValueError:
-       print 'conversion specifier:', format, ' failed.'
+        print 'conversion specifier:', format, ' failed.'
 
 time.timezone
 time.tzname
@@ -33,7 +33,7 @@ except TypeError:
 
 try:
     time.mktime((999999, 999999, 999999, 999999,
-                999999, 999999, 999999, 999999,
-                999999))
+                 999999, 999999, 999999, 999999,
+                 999999))
 except OverflowError:
     pass
index 1f695048a1be1ec882e7fb37e09fb5f09c08de30..1bfd47840b9101ae4f1423c403510dcf46e407dc 100644 (file)
@@ -5,8 +5,8 @@ l = [4, 5, 6]
 
 class Seq:
     def __getitem__(self, i):
-       if i >= 0 and i < 3: return i
-       raise IndexError
+        if i >= 0 and i < 3: return i
+        raise IndexError
 
 a = -1
 b = -1
@@ -104,12 +104,12 @@ BozoError = 'BozoError'
 
 class BadSeq:
     def __getitem__(self, i):
-       if i >= 0 and i < 3:
-           return i
-       elif i == 3:
-           raise BozoError
-       else:
-           raise IndexError
+        if i >= 0 and i < 3:
+            return i
+        elif i == 3:
+            raise BozoError
+        else:
+            raise IndexError
 
 
 # trigger code while not expecting an IndexError