diff options
Diffstat (limited to 'Lib')
55 files changed, 520 insertions, 519 deletions
diff --git a/Lib/distutils/cygwinccompiler.py b/Lib/distutils/cygwinccompiler.py index 5b06d3d..f40d1a2 100644 --- a/Lib/distutils/cygwinccompiler.py +++ b/Lib/distutils/cygwinccompiler.py @@ -241,7 +241,7 @@ class CygwinCCompiler (UnixCCompiler): objects.append(def_file) #end: if ((export_symbols is not None) and - # (target_desc <> self.EXECUTABLE or self.linker_dll == "gcc")): + # (target_desc != self.EXECUTABLE or self.linker_dll == "gcc")): # who wants symbols and a many times larger output file # should explicitly switch the debug mode on diff --git a/Lib/lib-old/Para.py b/Lib/lib-old/Para.py index bf5f92c..2e6aa4c 100644 --- a/Lib/lib-old/Para.py +++ b/Lib/lib-old/Para.py @@ -28,7 +28,7 @@ class Para: # Each word should be a 7-tuple: # (font, text, width, space, stretch, ascent, descent) def addword(self, d, font, text, space, stretch): - if font <> None: + if font is not None: d.setfont(font) width = d.textwidth(text) ascent = d.baseline() @@ -50,7 +50,7 @@ class Para: def getlength(self): total = 0 for word in self.words: - if type(word) <> Int: + if type(word) is not Int: total = total + word[2] + word[3] return total # @@ -63,7 +63,7 @@ class Para: as, de = 1, 0 for i in range(len(self.words)): word = self.words[i] - if type(word) == Int: continue + if type(word) is Int: continue (fo, te, wi, sp, st, as, de) = word self.words[i] = (fo, te, wi, sp, 0, as, de) total = total + wi + sp @@ -99,7 +99,7 @@ class Para: j = i while i < n: word = words[i] - if type(word) == Int: + if type(word) is Int: if word > 0 and width >= avail: break i = i+1 @@ -107,7 +107,7 @@ class Para: fo, te, wi, sp, st, as, de = word if width + wi > avail and width > 0 and wi > 0: break - if fo <> None: + if fo is not None: lastfont = fo if width == 0: firstfont = fo @@ -119,7 +119,7 @@ class Para: ascent = max(ascent, as) descent = max(descent, de) i = i+1 - while i > j and type(words[i-1]) == Int and \ + while i > j and type(words[i-1]) is Int and \ words[i-1] > 0: i = i-1 width = width - lsp if i < n: @@ -152,10 +152,10 @@ class Para: v2 = v + ascent + descent for j in range(i, i+wordcount): word = self.words[j] - if type(word) == Int: + if type(word) is Int: ok = anchorfunc(self, tuple, word, \ h, v) - if ok <> None: return ok + if ok is not None: return ok continue fo, te, wi, sp, st, as, de = word if extra > 0 and stretch > 0: @@ -167,7 +167,7 @@ class Para: h2 = h + wi + sp + ex ok = wordfunc(self, tuple, word, h, v, \ h2, v2, (j==i), (j==i+wordcount-1)) - if ok <> None: return ok + if ok is not None: return ok h = h2 v = v2 i = i + wordcount @@ -177,7 +177,7 @@ class Para: # given by (left, top, right) with an unspecified bottom. # Return the computed bottom of the text. def render(self, d, left, top, right): - if self.width <> right-left: + if self.width != right-left: self.layout(right-left) self.left = left self.top = top @@ -193,7 +193,7 @@ class Para: return self.bottom # def _renderword(self, tuple, word, h, v, h2, v2, isfirst, islast): - if word[0] <> None: self.d.setfont(word[0]) + if word[0] is not None: self.d.setfont(word[0]) baseline = v + tuple[5] self.d.text((h, baseline - word[5]), word[1]) if self.anchorid > 0: @@ -229,7 +229,7 @@ class Para: def extract(self): text = '' for w in self.words: - if type(w) <> Int: + if type(w) is not Int: word = w[1] if w[3]: word = word + ' ' text = text + word @@ -254,14 +254,14 @@ class Para: # def _whereisword(self, tuple, word, h1, v1, h2, v2, isfirst, islast): fo, te, wi, sp, st, as, de = word - if fo <> None: self.lastfont = fo + if fo is not None: self.lastfont = fo h = h1 if isfirst: h1 = 0 if islast: h2 = 999999 if not (v1 <= self.mousev <= v2 and h1 <= self.mouseh <= h2): self.charcount = self.charcount + len(te) + (sp > 0) return - if self.lastfont <> None: + if self.lastfont is not None: self.d.setfont(self.lastfont) cc = 0 for c in te: @@ -295,7 +295,7 @@ class Para: self.__class__._screenposanchor) finally: self.d = None - if ok == None: + if ok is None: ascent, descent = self.lines[-1][5:7] ok = self.right, self.bottom - ascent - descent, \ self.bottom - descent, self.bottom @@ -303,7 +303,7 @@ class Para: # def _screenposword(self, tuple, word, h1, v1, h2, v2, isfirst, islast): fo, te, wi, sp, st, as, de = word - if fo <> None: self.lastfont = fo + if fo is not None: self.lastfont = fo cc = len(te) + (sp > 0) if self.pos > cc: self.pos = self.pos - cc @@ -324,11 +324,11 @@ class Para: # if pos2 is None, the end is implied. # Undoes its own effect when called again with the same arguments def invert(self, d, pos1, pos2): - if pos1 == None: + if pos1 is None: pos1 = self.left, self.top, self.top, self.top else: pos1 = self.screenpos(d, pos1) - if pos2 == None: + if pos2 is None: pos2 = self.right, self.bottom,self.bottom,self.bottom else: pos2 = self.screenpos(d, pos2) diff --git a/Lib/lib-old/cmp.py b/Lib/lib-old/cmp.py index 943d8bd..1146a25 100644 --- a/Lib/lib-old/cmp.py +++ b/Lib/lib-old/cmp.py @@ -16,13 +16,13 @@ def cmp(f1, f2, shallow=1): Return 1 for identical files, 0 for different. Raise exceptions if either file could not be statted, read, etc.""" s1, s2 = sig(os.stat(f1)), sig(os.stat(f2)) - if s1[0] <> 8 or s2[0] <> 8: + if s1[0] != 8 or s2[0] != 8: # Either is a not a plain file -- always report as different return 0 if shallow and s1 == s2: # type, size & mtime match -- report same return 1 - if s1[:2] <> s2[:2]: # Types or sizes differ, don't bother + if s1[:2] != s2[:2]: # Types or sizes differ, don't bother # types or sizes differ -- report different return 0 # same type and size -- look in the cache @@ -59,5 +59,5 @@ def do_cmp(f1, f2): while 1: b1 = fp1.read(bufsize) b2 = fp2.read(bufsize) - if b1 <> b2: return 0 + if b1 != b2: return 0 if not b1: return 1 diff --git a/Lib/lib-old/cmpcache.py b/Lib/lib-old/cmpcache.py index 93332b7..11540f8 100644 --- a/Lib/lib-old/cmpcache.py +++ b/Lib/lib-old/cmpcache.py @@ -30,7 +30,7 @@ def cmp(f1, f2, shallow=1): if shallow and s1 == s2: # type, size & mtime match -- report same return 1 - if s1[:2] <> s2[:2]: # Types or sizes differ, don't bother + if s1[:2] != s2[:2]: # Types or sizes differ, don't bother # types or sizes differ -- report different return 0 # same type and size -- look in the cache @@ -60,5 +60,5 @@ def do_cmp(f1, f2): while 1: b1 = fp1.read(bufsize) b2 = fp2.read(bufsize) - if b1 <> b2: return 0 + if b1 != b2: return 0 if not b1: return 1 diff --git a/Lib/lib-old/dircmp.py b/Lib/lib-old/dircmp.py index 13a8a04..1e7bf2a 100644 --- a/Lib/lib-old/dircmp.py +++ b/Lib/lib-old/dircmp.py @@ -70,7 +70,7 @@ class dircmp: if ok: a_type = S_IFMT(a_stat[ST_MODE]) b_type = S_IFMT(b_stat[ST_MODE]) - if a_type <> b_type: + if a_type != b_type: self.common_funny.append(x) elif S_ISDIR(a_type): self.common_dirs.append(x) @@ -189,7 +189,8 @@ def demo(): import sys import getopt options, args = getopt.getopt(sys.argv[1:], 'r') - if len(args) <> 2: raise getopt.error, 'need exactly two args' + if len(args) != 2: + raise getopt.error, 'need exactly two args' dd = dircmp().new(args[0], args[1]) dd.run() if ('-r', '') in options: diff --git a/Lib/lib-old/fmt.py b/Lib/lib-old/fmt.py index 86671cd..dfea987 100644 --- a/Lib/lib-old/fmt.py +++ b/Lib/lib-old/fmt.py @@ -68,20 +68,20 @@ class SavingBackEnd(NullBackEnd): for i in range(len(self.paralist)): p = self.paralist[i] result = p.whereis(d, h, v) - if result <> None: + if result is not None: return i, result return None # def roundtowords(self, long1, long2): i, offset = long1 text = self.paralist[i].extract() - while offset > 0 and text[offset-1] <> ' ': offset = offset-1 + while offset > 0 and text[offset-1] != ' ': offset = offset-1 long1 = i, offset # i, offset = long2 text = self.paralist[i].extract() n = len(text) - while offset < n-1 and text[offset] <> ' ': offset = offset+1 + while offset < n-1 and text[offset] != ' ': offset = offset+1 long2 = i, offset # return long1, long2 @@ -159,7 +159,7 @@ class BaseFormatter: return Para.Para() # def setfont(self, font): - if font == None: return + if font is None: return self.font = self.nextfont = font d = self.d d.setfont(font) @@ -193,7 +193,7 @@ class BaseFormatter: if self.para: self.b.addpara(self.para) self.para = None - if self.font <> None: + if self.font is not None: self.d.setfont(self.font) self.nospace = 1 # @@ -338,8 +338,8 @@ def finalize(para): para.words.append(('r', '', 0, 0, 0, 0)) # temporary, deleted at end for i in range(len(para.words)): fo, te, wi = para.words[i][:3] - if fo <> None: curfont = fo - if curfont <> oldfont: + if fo is not None: curfont = fo + if curfont != oldfont: if closechar.has_key(oldfont): c = closechar[oldfont] j = i-1 @@ -430,7 +430,7 @@ class StdwinBackEnd(SavingBackEnd): pos1 = long1[:3] pos2 = long2[:3] new = pos1, pos2 - if new <> self.selection: + if new != self.selection: d = self.window.begindrawing() if self.selection: self.invert(d, self.selection) @@ -462,7 +462,7 @@ class StdwinBackEnd(SavingBackEnd): # def search(self, prog): import re, string - if type(prog) == type(''): + if type(prog) is type(''): prog = re.compile(string.lower(prog)) if self.selection: iold = self.selection[0][0] @@ -551,7 +551,7 @@ class GLFontCache: self.fontcache[fontkey] = \ self.fontcache[key] = handle self.fontkey = fontkey - if self.fonthandle <> handle: + if self.fonthandle != handle: self.fonthandle = handle self.fontinfo = handle.getfontinfo() handle.setfont() @@ -582,7 +582,7 @@ class GLWriter(GLFontCache): def setfont(self, fontkey): oldhandle = self.fonthandle GLFontCache.setfont(fontkey) - if self.fonthandle <> oldhandle: + if self.fonthandle != oldhandle: handle.setfont() @@ -612,7 +612,7 @@ class GLBackEnd(SavingBackEnd): import gl gl.winset(self.wid) width = gl.getsize()[1] - if width <> self.width: + if width != self.width: setdocsize = 1 self.width = width for p in self.paralist: diff --git a/Lib/lib-old/grep.py b/Lib/lib-old/grep.py index 423c065..6f74fd3 100644 --- a/Lib/lib-old/grep.py +++ b/Lib/lib-old/grep.py @@ -73,7 +73,7 @@ def showline(filename, lineno, line, prog): else: prefix = ' ' * len(prefix) for c in line: - if c <> '\t': c = ' ' + if c != '\t': c = ' ' prefix = prefix + c if start == end: prefix = prefix + '\\' else: prefix = prefix + '^'*(end-start) diff --git a/Lib/lib-old/packmail.py b/Lib/lib-old/packmail.py index 4541c51..2a5aa75 100644 --- a/Lib/lib-old/packmail.py +++ b/Lib/lib-old/packmail.py @@ -25,7 +25,7 @@ def pack(outfp, file, name): while 1: line = fp.readline() if not line: break - if line[-1:] <> '\n': + if line[-1:] != '\n': line = line + '\n' outfp.write('X' + line) outfp.write('!\n') diff --git a/Lib/lib-old/tb.py b/Lib/lib-old/tb.py index 5c592ce..abe4824 100644 --- a/Lib/lib-old/tb.py +++ b/Lib/lib-old/tb.py @@ -23,7 +23,7 @@ def browser(tb): ptr = len(tblist)-1 tb = tblist[ptr] while 1: - if tb <> tblist[ptr]: + if tb != tblist[ptr]: tb = tblist[ptr] print `ptr` + ':', printtbheader(tb) @@ -76,11 +76,11 @@ def browserexec(tb, cmd): except: t, v = sys.exc_info()[:2] print '*** Exception:', - if type(t) == type(''): + if type(t) is type(''): print t, else: print t.__name__, - if v <> None: + if v is not None: print ':', v, print print 'Type help to get help.' @@ -127,24 +127,24 @@ def printsymbols(d): print def printobject(v, maxlevel): - if v == None: + if v is None: print 'None', elif type(v) in (type(0), type(0.0)): print v, - elif type(v) == type(''): + elif type(v) is type(''): if len(v) > 20: print `v[:17] + '...'`, else: print `v`, - elif type(v) == type(()): + elif type(v) is type(()): print '(', printlist(v, maxlevel) print ')', - elif type(v) == type([]): + elif type(v) is type([]): print '[', printlist(v, maxlevel) print ']', - elif type(v) == type({}): + elif type(v) is type({}): print '{', printdict(v, maxlevel) print '}', diff --git a/Lib/lib-old/zmod.py b/Lib/lib-old/zmod.py index 4f03626..7259bf8 100644 --- a/Lib/lib-old/zmod.py +++ b/Lib/lib-old/zmod.py @@ -82,13 +82,13 @@ def checkfield(n, p): print inv def rj(s, width): - if type(s) <> type(''): s = `s` + if type(s) is not type(''): s = `s` n = len(s) if n >= width: return s return ' '*(width - n) + s def lj(s, width): - if type(s) <> type(''): s = `s` + if type(s) is not type(''): s = `s` n = len(s) if n >= width: return s return s + ' '*(width - n) diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py index 4f8c1ed..c4e78a2 100644 --- a/Lib/lib-tk/Tkinter.py +++ b/Lib/lib-tk/Tkinter.py @@ -339,7 +339,7 @@ class Misc: """Wait until a WIDGET is destroyed. If no parameter is given self is used.""" - if window == None: + if window is None: window = self self.tk.call('tkwait', 'window', window._w) def wait_visibility(self, window=None): @@ -347,7 +347,7 @@ class Misc: (e.g. it appears). If no parameter is given self is used.""" - if window == None: + if window is None: window = self self.tk.call('tkwait', 'visibility', window._w) def setvar(self, name='PY_VAR', value='1'): diff --git a/Lib/plat-irix5/FL.py b/Lib/plat-irix5/FL.py index f85237b..ae665e3 100755 --- a/Lib/plat-irix5/FL.py +++ b/Lib/plat-irix5/FL.py @@ -7,7 +7,7 @@ _v20 = 1 _v21 = 1 ##import fl ##try: -## _v20 = (fl.get_rgbmode <> None) +## _v20 = (fl.get_rgbmode is not None) ##except: ## _v20 = 0 ##del fl diff --git a/Lib/plat-irix5/cdplayer.py b/Lib/plat-irix5/cdplayer.py index eeb56ce..278da03 100755 --- a/Lib/plat-irix5/cdplayer.py +++ b/Lib/plat-irix5/cdplayer.py @@ -77,7 +77,7 @@ class Cdplayer: line = old.readline() if line == '': break - if line[:l] <> s: + if line[:l] != s: new.write(line) new.write(self.id + '.title:\t' + self.title + '\n') new.write(self.id + '.artist:\t' + self.artist + '\n') diff --git a/Lib/plat-irix5/flp.py b/Lib/plat-irix5/flp.py index 6c6dae5..7d5814a 100755 --- a/Lib/plat-irix5/flp.py +++ b/Lib/plat-irix5/flp.py @@ -36,7 +36,7 @@ def parse_form(filename, formname): # def parse_forms(filename): forms = checkcache(filename) - if forms != None: return forms + if forms is not None: return forms fp = _open_formfile(filename) nforms = _parse_fd_header(fp) forms = {} @@ -168,7 +168,7 @@ def _open_formfile(filename): return _open_formfile2(filename)[0] def _open_formfile2(filename): - if filename[-3:] <> '.fd': + if filename[-3:] != '.fd': filename = filename + '.fd' if filename[0] == '/': try: @@ -184,7 +184,7 @@ def _open_formfile2(filename): break except IOError: fp = None - if fp == None: + if fp is None: raise error, 'Cannot find forms file ' + filename return fp, filename @@ -194,7 +194,7 @@ def _open_formfile2(filename): def _parse_fd_header(file): # First read the magic header line datum = _parse_1_line(file) - if datum <> ('Magic', 12321): + if datum != ('Magic', 12321): raise error, 'Not a forms definition file' # Now skip until we know number of forms while 1: @@ -208,10 +208,10 @@ def _parse_fd_header(file): # def _parse_fd_form(file, name): datum = _parse_1_line(file) - if datum <> FORMLINE: + if datum != FORMLINE: raise error, 'Missing === FORM === line' form = _parse_object(file) - if form.Name == name or name == None: + if form.Name == name or name is None: objs = [] for j in range(form.Numberofobjects): obj = _parse_object(file) @@ -316,7 +316,7 @@ def _parse_object(file): if datum == FORMLINE: file.seek(pos) return obj - if type(datum) <> type(()) or len(datum) <> 2: + if type(datum) is not type(()) or len(datum) != 2: raise error, 'Parse error, illegal line in object: '+datum obj.add(datum[0], datum[1]) @@ -339,7 +339,7 @@ def create_full_form(inst, (fdata, odatalist)): # def merge_full_form(inst, form, (fdata, odatalist)): exec 'inst.'+fdata.Name+' = form\n' - if odatalist[0].Class <> FL.BOX: + if odatalist[0].Class != FL.BOX: raise error, 'merge_full_form() expects FL.BOX as first obj' for odata in odatalist[1:]: create_object_instance(inst, form, odata) diff --git a/Lib/plat-irix5/jpeg.py b/Lib/plat-irix5/jpeg.py index 298ebb5..da20d6b 100755 --- a/Lib/plat-irix5/jpeg.py +++ b/Lib/plat-irix5/jpeg.py @@ -59,7 +59,7 @@ def decompress(jpegdata): return imgdata, width, height, bytesperpixel def setoption(name, value): - if type(value) <> type(0): + if type(value) is not type(0): raise TypeError, 'jpeg.setoption: numeric options only' if name == 'forcegrey': name = 'forcegray' diff --git a/Lib/plat-irix5/panel.py b/Lib/plat-irix5/panel.py index 629bee5..f8388c6 100755 --- a/Lib/plat-irix5/panel.py +++ b/Lib/plat-irix5/panel.py @@ -207,7 +207,7 @@ def build_panel(descr): # # Sanity check # - if (not descr) or descr[0] <> 'panel': + if (not descr) or descr[0] != 'panel': raise panel_error, 'panel description must start with "panel"' # if debug: show_panel('', descr) diff --git a/Lib/plat-irix5/panelparser.py b/Lib/plat-irix5/panelparser.py index 1b069fa..ee50971 100755 --- a/Lib/plat-irix5/panelparser.py +++ b/Lib/plat-irix5/panelparser.py @@ -71,7 +71,7 @@ syntax_error = 'syntax error' # May raise syntax_error. # def parse_expr(tokens): - if (not tokens) or tokens[0] <> '(': + if (not tokens) or tokens[0] != '(': raise syntax_error, 'expected "("' tokens = tokens[1:] expr = [] diff --git a/Lib/plat-irix5/readcd.py b/Lib/plat-irix5/readcd.py index 403353f..e000d35 100755 --- a/Lib/plat-irix5/readcd.py +++ b/Lib/plat-irix5/readcd.py @@ -93,7 +93,7 @@ class Readcd: if prog < self.status[5] or prog > self.status[6]: raise Error, 'range error' end = self.pmsf2msf(prog, min, sec, frame) - elif l <> 3: + elif l != 3: raise Error, 'syntax error' if type(start) == type(0): if start < self.status[5] or start > self.status[6]: @@ -111,7 +111,7 @@ class Readcd: if prog < self.status[5] or prog > self.status[6]: raise Error, 'range error' start = self.pmsf2msf(prog, min, sec, frame) - elif l <> 3: + elif l != 3: raise Error, 'syntax error' self.list.append((start, end)) @@ -127,10 +127,10 @@ class Readcd: if self.playing: start, end = self.list[self.listindex] if type(end) == type(0): - if cb_type <> CD.PNUM: + if cb_type != CD.PNUM: self.parser.setcallback(cb_type, func, arg) else: - if cb_type <> CD.ATIME: + if cb_type != CD.ATIME: self.parser.setcallback(cb_type, func, arg) def removecallback(self, cb_type): @@ -140,10 +140,10 @@ class Readcd: if self.playing: start, end = self.list[self.listindex] if type(end) == type(0): - if cb_type <> CD.PNUM: + if cb_type != CD.PNUM: self.parser.removecallback(cb_type) else: - if cb_type <> CD.ATIME: + if cb_type != CD.ATIME: self.parser.removecallback(cb_type) def gettrackinfo(self, *arg): diff --git a/Lib/plat-irix5/torgb.py b/Lib/plat-irix5/torgb.py index 59e3fbe..7cc3b47 100755 --- a/Lib/plat-irix5/torgb.py +++ b/Lib/plat-irix5/torgb.py @@ -60,7 +60,7 @@ def torgb(filename): ret = _torgb(filename, temps) finally: for temp in temps[:]: - if temp <> ret: + if temp != ret: try: os.unlink(temp) except os.error: @@ -83,12 +83,12 @@ def _torgb(filename, temps): if type(msg) == type(()) and len(msg) == 2 and \ type(msg[0]) == type(0) and type(msg[1]) == type(''): msg = msg[1] - if type(msg) <> type(''): + if type(msg) is not type(''): msg = `msg` raise error, filename + ': ' + msg if ftype == 'rgb': return fname - if ftype == None or not table.has_key(ftype): + if ftype is None or not table.has_key(ftype): raise error, \ filename + ': unsupported image file type ' + `ftype` temp = tempfile.mktemp() diff --git a/Lib/plat-irix6/FL.py b/Lib/plat-irix6/FL.py index f85237b..ae665e3 100644 --- a/Lib/plat-irix6/FL.py +++ b/Lib/plat-irix6/FL.py @@ -7,7 +7,7 @@ _v20 = 1 _v21 = 1 ##import fl ##try: -## _v20 = (fl.get_rgbmode <> None) +## _v20 = (fl.get_rgbmode is not None) ##except: ## _v20 = 0 ##del fl diff --git a/Lib/plat-irix6/cdplayer.py b/Lib/plat-irix6/cdplayer.py index eeb56ce..278da03 100644 --- a/Lib/plat-irix6/cdplayer.py +++ b/Lib/plat-irix6/cdplayer.py @@ -77,7 +77,7 @@ class Cdplayer: line = old.readline() if line == '': break - if line[:l] <> s: + if line[:l] != s: new.write(line) new.write(self.id + '.title:\t' + self.title + '\n') new.write(self.id + '.artist:\t' + self.artist + '\n') diff --git a/Lib/plat-irix6/flp.py b/Lib/plat-irix6/flp.py index 6c6dae5..7d5814a 100644 --- a/Lib/plat-irix6/flp.py +++ b/Lib/plat-irix6/flp.py @@ -36,7 +36,7 @@ def parse_form(filename, formname): # def parse_forms(filename): forms = checkcache(filename) - if forms != None: return forms + if forms is not None: return forms fp = _open_formfile(filename) nforms = _parse_fd_header(fp) forms = {} @@ -168,7 +168,7 @@ def _open_formfile(filename): return _open_formfile2(filename)[0] def _open_formfile2(filename): - if filename[-3:] <> '.fd': + if filename[-3:] != '.fd': filename = filename + '.fd' if filename[0] == '/': try: @@ -184,7 +184,7 @@ def _open_formfile2(filename): break except IOError: fp = None - if fp == None: + if fp is None: raise error, 'Cannot find forms file ' + filename return fp, filename @@ -194,7 +194,7 @@ def _open_formfile2(filename): def _parse_fd_header(file): # First read the magic header line datum = _parse_1_line(file) - if datum <> ('Magic', 12321): + if datum != ('Magic', 12321): raise error, 'Not a forms definition file' # Now skip until we know number of forms while 1: @@ -208,10 +208,10 @@ def _parse_fd_header(file): # def _parse_fd_form(file, name): datum = _parse_1_line(file) - if datum <> FORMLINE: + if datum != FORMLINE: raise error, 'Missing === FORM === line' form = _parse_object(file) - if form.Name == name or name == None: + if form.Name == name or name is None: objs = [] for j in range(form.Numberofobjects): obj = _parse_object(file) @@ -316,7 +316,7 @@ def _parse_object(file): if datum == FORMLINE: file.seek(pos) return obj - if type(datum) <> type(()) or len(datum) <> 2: + if type(datum) is not type(()) or len(datum) != 2: raise error, 'Parse error, illegal line in object: '+datum obj.add(datum[0], datum[1]) @@ -339,7 +339,7 @@ def create_full_form(inst, (fdata, odatalist)): # def merge_full_form(inst, form, (fdata, odatalist)): exec 'inst.'+fdata.Name+' = form\n' - if odatalist[0].Class <> FL.BOX: + if odatalist[0].Class != FL.BOX: raise error, 'merge_full_form() expects FL.BOX as first obj' for odata in odatalist[1:]: create_object_instance(inst, form, odata) diff --git a/Lib/plat-irix6/jpeg.py b/Lib/plat-irix6/jpeg.py index 1af6a01..2354f40 100644 --- a/Lib/plat-irix6/jpeg.py +++ b/Lib/plat-irix6/jpeg.py @@ -59,7 +59,7 @@ def decompress(jpegdata): return imgdata, width, height, bytesperpixel def setoption(name, value): - if type(value) <> type(0): + if type(value) is not type(0): raise TypeError, 'jpeg.setoption: numeric options only' if name == 'forcegrey': name = 'forcegray' diff --git a/Lib/plat-irix6/panel.py b/Lib/plat-irix6/panel.py index 629bee5..f8388c6 100644 --- a/Lib/plat-irix6/panel.py +++ b/Lib/plat-irix6/panel.py @@ -207,7 +207,7 @@ def build_panel(descr): # # Sanity check # - if (not descr) or descr[0] <> 'panel': + if (not descr) or descr[0] != 'panel': raise panel_error, 'panel description must start with "panel"' # if debug: show_panel('', descr) diff --git a/Lib/plat-irix6/panelparser.py b/Lib/plat-irix6/panelparser.py index 1b069fa..ee50971 100644 --- a/Lib/plat-irix6/panelparser.py +++ b/Lib/plat-irix6/panelparser.py @@ -71,7 +71,7 @@ syntax_error = 'syntax error' # May raise syntax_error. # def parse_expr(tokens): - if (not tokens) or tokens[0] <> '(': + if (not tokens) or tokens[0] != '(': raise syntax_error, 'expected "("' tokens = tokens[1:] expr = [] diff --git a/Lib/plat-irix6/readcd.py b/Lib/plat-irix6/readcd.py index 403353f..e000d35 100644 --- a/Lib/plat-irix6/readcd.py +++ b/Lib/plat-irix6/readcd.py @@ -93,7 +93,7 @@ class Readcd: if prog < self.status[5] or prog > self.status[6]: raise Error, 'range error' end = self.pmsf2msf(prog, min, sec, frame) - elif l <> 3: + elif l != 3: raise Error, 'syntax error' if type(start) == type(0): if start < self.status[5] or start > self.status[6]: @@ -111,7 +111,7 @@ class Readcd: if prog < self.status[5] or prog > self.status[6]: raise Error, 'range error' start = self.pmsf2msf(prog, min, sec, frame) - elif l <> 3: + elif l != 3: raise Error, 'syntax error' self.list.append((start, end)) @@ -127,10 +127,10 @@ class Readcd: if self.playing: start, end = self.list[self.listindex] if type(end) == type(0): - if cb_type <> CD.PNUM: + if cb_type != CD.PNUM: self.parser.setcallback(cb_type, func, arg) else: - if cb_type <> CD.ATIME: + if cb_type != CD.ATIME: self.parser.setcallback(cb_type, func, arg) def removecallback(self, cb_type): @@ -140,10 +140,10 @@ class Readcd: if self.playing: start, end = self.list[self.listindex] if type(end) == type(0): - if cb_type <> CD.PNUM: + if cb_type != CD.PNUM: self.parser.removecallback(cb_type) else: - if cb_type <> CD.ATIME: + if cb_type != CD.ATIME: self.parser.removecallback(cb_type) def gettrackinfo(self, *arg): diff --git a/Lib/plat-irix6/torgb.py b/Lib/plat-irix6/torgb.py index 59e3fbe..7cc3b47 100644 --- a/Lib/plat-irix6/torgb.py +++ b/Lib/plat-irix6/torgb.py @@ -60,7 +60,7 @@ def torgb(filename): ret = _torgb(filename, temps) finally: for temp in temps[:]: - if temp <> ret: + if temp != ret: try: os.unlink(temp) except os.error: @@ -83,12 +83,12 @@ def _torgb(filename, temps): if type(msg) == type(()) and len(msg) == 2 and \ type(msg[0]) == type(0) and type(msg[1]) == type(''): msg = msg[1] - if type(msg) <> type(''): + if type(msg) is not type(''): msg = `msg` raise error, filename + ': ' + msg if ftype == 'rgb': return fname - if ftype == None or not table.has_key(ftype): + if ftype is None or not table.has_key(ftype): raise error, \ filename + ': unsupported image file type ' + `ftype` temp = tempfile.mktemp() diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index 3d9c5af..dadf69b 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -283,7 +283,7 @@ class Compare: def write(self, data): expected = self.fp.read(len(data)) - if data <> expected: + if data != expected: raise test_support.TestFailed, \ 'Writing: '+`data`+', expected: '+`expected` diff --git a/Lib/test/test_audioop.py b/Lib/test/test_audioop.py index 900ec58..495a918 100644 --- a/Lib/test/test_audioop.py +++ b/Lib/test/test_audioop.py @@ -24,61 +24,61 @@ def gendata4(): def testmax(data): if verbose: print 'max' - if audioop.max(data[0], 1) <> 2 or \ - audioop.max(data[1], 2) <> 2 or \ - audioop.max(data[2], 4) <> 2: + if audioop.max(data[0], 1) != 2 or \ + audioop.max(data[1], 2) != 2 or \ + audioop.max(data[2], 4) != 2: return 0 return 1 def testminmax(data): if verbose: 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): + 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 return 1 def testmaxpp(data): if verbose: print 'maxpp' - if audioop.maxpp(data[0], 1) <> 0 or \ - audioop.maxpp(data[1], 2) <> 0 or \ - audioop.maxpp(data[2], 4) <> 0: + if audioop.maxpp(data[0], 1) != 0 or \ + audioop.maxpp(data[1], 2) != 0 or \ + audioop.maxpp(data[2], 4) != 0: return 0 return 1 def testavg(data): if verbose: print 'avg' - if audioop.avg(data[0], 1) <> 1 or \ - audioop.avg(data[1], 2) <> 1 or \ - audioop.avg(data[2], 4) <> 1: + if audioop.avg(data[0], 1) != 1 or \ + audioop.avg(data[1], 2) != 1 or \ + audioop.avg(data[2], 4) != 1: return 0 return 1 def testavgpp(data): if verbose: print 'avgpp' - if audioop.avgpp(data[0], 1) <> 0 or \ - audioop.avgpp(data[1], 2) <> 0 or \ - audioop.avgpp(data[2], 4) <> 0: + if audioop.avgpp(data[0], 1) != 0 or \ + 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: + if audioop.rms(data[0], 1) != 1 or \ + audioop.rms(data[1], 2) != 1 or \ + audioop.rms(data[2], 4) != 1: return 0 return 1 def testcross(data): if verbose: print 'cross' - if audioop.cross(data[0], 1) <> 0 or \ - audioop.cross(data[1], 2) <> 0 or \ - audioop.cross(data[2], 4) <> 0: + if audioop.cross(data[0], 1) != 0 or \ + audioop.cross(data[1], 2) != 0 or \ + audioop.cross(data[2], 4) != 0: return 0 return 1 @@ -91,9 +91,9 @@ def testadd(data): 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]: + 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 return 1 @@ -104,9 +104,9 @@ def testbias(data): 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: + if audioop.avg(d1, 1) != 101 or \ + audioop.avg(d2, 2) != 101 or \ + audioop.avg(d4, 4) != 101: return 0 return 1 @@ -118,13 +118,13 @@ def testlin2lin(data): for d2 in data: got = len(d1)/3 wtd = len(d2)/3 - if len(audioop.lin2lin(d1, got, wtd)) <> len(d2): + 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)): + if audioop.adpcm2lin('\0\0', 1, None) != ('\0\0\0\0', (0,0)): return 0 return 1 @@ -132,16 +132,16 @@ def testlin2adpcm(data): if verbose: print 'lin2adpcm' # Very cursory test - if audioop.lin2adpcm('\0\0\0\0', 1, None) <> ('\0\0', (0,0)): + if audioop.lin2adpcm('\0\0\0\0', 1, None) != ('\0\0', (0,0)): return 0 return 1 def testlin2ulaw(data): if verbose: 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': + 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 return 1 @@ -150,7 +150,7 @@ def testulaw2lin(data): print 'ulaw2lin' # Cursory d = audioop.lin2ulaw(data[0], 1) - if audioop.ulaw2lin(d, 1) <> data[0]: + if audioop.ulaw2lin(d, 1) != data[0]: return 0 return 1 @@ -163,9 +163,9 @@ def testmul(data): 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]: + 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 return 1 @@ -182,7 +182,7 @@ def testratecv(data): def testreverse(data): if verbose: print 'reverse' - if audioop.reverse(data[0], 1) <> '\2\1\0': + if audioop.reverse(data[0], 1) != '\2\1\0': return 0 return 1 @@ -192,7 +192,7 @@ def testtomono(data): data2 = '' for d in data[0]: data2 = data2 + d + d - if audioop.tomono(data2, 1, 0.5, 0.5) <> data[0]: + if audioop.tomono(data2, 1, 0.5, 0.5) != data[0]: return 0 return 1 @@ -202,28 +202,28 @@ def testtostereo(data): data2 = '' for d in data[0]: data2 = data2 + d + d - if audioop.tostereo(data[0], 1, 1, 1) <> data2: + if audioop.tostereo(data[0], 1, 1, 1) != data2: return 0 return 1 def testfindfactor(data): if verbose: print 'findfactor' - if audioop.findfactor(data[1], data[1]) <> 1.0: + if audioop.findfactor(data[1], data[1]) != 1.0: return 0 return 1 def testfindfit(data): if verbose: print 'findfit' - if audioop.findfit(data[1], data[1]) <> (0, 1.0): + if audioop.findfit(data[1], data[1]) != (0, 1.0): return 0 return 1 def testfindmax(data): if verbose: print 'findmax' - if audioop.findmax(data[1], 1) <> 2: + if audioop.findmax(data[1], 1) != 2: return 0 return 1 @@ -231,9 +231,9 @@ def testgetsample(data): if verbose: 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: + 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 diff --git a/Lib/test/test_b1.py b/Lib/test/test_b1.py index 24c5279..8adcbef 100644 --- a/Lib/test/test_b1.py +++ b/Lib/test/test_b1.py @@ -11,17 +11,17 @@ except ImportError: pass else: raise TestFailed, "__import__('spamspam') should fail" print 'abs' -if abs(0) <> 0: raise TestFailed, 'abs(0)' -if abs(1234) <> 1234: raise TestFailed, 'abs(1234)' -if abs(-1234) <> 1234: raise TestFailed, 'abs(-1234)' +if abs(0) != 0: raise TestFailed, 'abs(0)' +if abs(1234) != 1234: raise TestFailed, 'abs(1234)' +if abs(-1234) != 1234: raise TestFailed, 'abs(-1234)' # -if abs(0.0) <> 0.0: raise TestFailed, 'abs(0.0)' -if abs(3.14) <> 3.14: raise TestFailed, 'abs(3.14)' -if abs(-3.14) <> 3.14: raise TestFailed, 'abs(-3.14)' +if abs(0.0) != 0.0: raise TestFailed, 'abs(0.0)' +if abs(3.14) != 3.14: raise TestFailed, 'abs(3.14)' +if abs(-3.14) != 3.14: raise TestFailed, 'abs(-3.14)' # -if abs(0L) <> 0L: raise TestFailed, 'abs(0L)' -if abs(1234L) <> 1234L: raise TestFailed, 'abs(1234L)' -if abs(-1234L) <> 1234L: raise TestFailed, 'abs(-1234L)' +if abs(0L) != 0L: raise TestFailed, 'abs(0L)' +if abs(1234L) != 1234L: raise TestFailed, 'abs(1234L)' +if abs(-1234L) != 1234L: raise TestFailed, 'abs(-1234L)' print 'apply' def f0(*args): @@ -55,14 +55,14 @@ y = D() if not callable(y): raise TestFailed, 'callable(y)' print 'chr' -if chr(32) <> ' ': raise TestFailed, 'chr(32)' -if chr(65) <> 'A': raise TestFailed, 'chr(65)' -if chr(97) <> 'a': raise TestFailed, 'chr(97)' +if chr(32) != ' ': raise TestFailed, 'chr(32)' +if chr(65) != 'A': raise TestFailed, 'chr(65)' +if chr(97) != 'a': raise TestFailed, 'chr(97)' print 'cmp' -if cmp(-1, 1) <> -1: raise TestFailed, 'cmp(-1, 1)' -if cmp(1, -1) <> 1: raise TestFailed, 'cmp(1, -1)' -if cmp(1, 1) <> 0: raise TestFailed, 'cmp(1, 1)' +if cmp(-1, 1) != -1: raise TestFailed, 'cmp(-1, 1)' +if cmp(1, -1) != 1: raise TestFailed, 'cmp(1, -1)' +if cmp(1, 1) != 0: raise TestFailed, 'cmp(1, 1)' # verify that circular objects are handled a = []; a.append(a) b = []; b.append(b) @@ -77,40 +77,40 @@ a.pop(); b.pop(); c.pop() print 'coerce' if fcmp(coerce(1, 1.1), (1.0, 1.1)): raise TestFailed, 'coerce(1, 1.1)' -if coerce(1, 1L) <> (1L, 1L): raise TestFailed, 'coerce(1, 1L)' +if coerce(1, 1L) != (1L, 1L): raise TestFailed, 'coerce(1, 1L)' if fcmp(coerce(1L, 1.1), (1.0, 1.1)): raise TestFailed, 'coerce(1L, 1.1)' print 'compile' compile('print 1\n', '', 'exec') print 'complex' -if complex(1,10) <> 1+10j: raise TestFailed, 'complex(1,10)' -if complex(1,10L) <> 1+10j: raise TestFailed, 'complex(1,10L)' -if complex(1,10.0) <> 1+10j: raise TestFailed, 'complex(1,10.0)' -if complex(1L,10) <> 1+10j: raise TestFailed, 'complex(1L,10)' -if complex(1L,10L) <> 1+10j: raise TestFailed, 'complex(1L,10L)' -if complex(1L,10.0) <> 1+10j: raise TestFailed, 'complex(1L,10.0)' -if complex(1.0,10) <> 1+10j: raise TestFailed, 'complex(1.0,10)' -if complex(1.0,10L) <> 1+10j: raise TestFailed, 'complex(1.0,10L)' -if complex(1.0,10.0) <> 1+10j: raise TestFailed, 'complex(1.0,10.0)' -if complex(3.14+0j) <> 3.14+0j: raise TestFailed, 'complex(3.14)' -if complex(3.14) <> 3.14+0j: raise TestFailed, 'complex(3.14)' -if complex(314) <> 314.0+0j: raise TestFailed, 'complex(314)' -if complex(314L) <> 314.0+0j: raise TestFailed, 'complex(314L)' -if complex(3.14+0j, 0j) <> 3.14+0j: raise TestFailed, 'complex(3.14, 0j)' -if complex(3.14, 0.0) <> 3.14+0j: raise TestFailed, 'complex(3.14, 0.0)' -if complex(314, 0) <> 314.0+0j: raise TestFailed, 'complex(314, 0)' -if complex(314L, 0L) <> 314.0+0j: raise TestFailed, 'complex(314L, 0L)' -if complex(0j, 3.14j) <> -3.14+0j: raise TestFailed, 'complex(0j, 3.14j)' -if complex(0.0, 3.14j) <> -3.14+0j: raise TestFailed, 'complex(0.0, 3.14j)' -if complex(0j, 3.14) <> 3.14j: raise TestFailed, 'complex(0j, 3.14)' -if complex(0.0, 3.14) <> 3.14j: raise TestFailed, 'complex(0.0, 3.14)' -if complex(" 3.14+J ") <> 3.14+1j: raise TestFailed, 'complex(" 3.14+J )"' -if complex(u" 3.14+J ") <> 3.14+1j: raise TestFailed, 'complex(u" 3.14+J )"' +if complex(1,10) != 1+10j: raise TestFailed, 'complex(1,10)' +if complex(1,10L) != 1+10j: raise TestFailed, 'complex(1,10L)' +if complex(1,10.0) != 1+10j: raise TestFailed, 'complex(1,10.0)' +if complex(1L,10) != 1+10j: raise TestFailed, 'complex(1L,10)' +if complex(1L,10L) != 1+10j: raise TestFailed, 'complex(1L,10L)' +if complex(1L,10.0) != 1+10j: raise TestFailed, 'complex(1L,10.0)' +if complex(1.0,10) != 1+10j: raise TestFailed, 'complex(1.0,10)' +if complex(1.0,10L) != 1+10j: raise TestFailed, 'complex(1.0,10L)' +if complex(1.0,10.0) != 1+10j: raise TestFailed, 'complex(1.0,10.0)' +if complex(3.14+0j) != 3.14+0j: raise TestFailed, 'complex(3.14)' +if complex(3.14) != 3.14+0j: raise TestFailed, 'complex(3.14)' +if complex(314) != 314.0+0j: raise TestFailed, 'complex(314)' +if complex(314L) != 314.0+0j: raise TestFailed, 'complex(314L)' +if complex(3.14+0j, 0j) != 3.14+0j: raise TestFailed, 'complex(3.14, 0j)' +if complex(3.14, 0.0) != 3.14+0j: raise TestFailed, 'complex(3.14, 0.0)' +if complex(314, 0) != 314.0+0j: raise TestFailed, 'complex(314, 0)' +if complex(314L, 0L) != 314.0+0j: raise TestFailed, 'complex(314L, 0L)' +if complex(0j, 3.14j) != -3.14+0j: raise TestFailed, 'complex(0j, 3.14j)' +if complex(0.0, 3.14j) != -3.14+0j: raise TestFailed, 'complex(0.0, 3.14j)' +if complex(0j, 3.14) != 3.14j: raise TestFailed, 'complex(0j, 3.14)' +if complex(0.0, 3.14) != 3.14j: raise TestFailed, 'complex(0.0, 3.14)' +if complex(" 3.14+J ") != 3.14+1j: raise TestFailed, 'complex(" 3.14+J )"' +if complex(u" 3.14+J ") != 3.14+1j: raise TestFailed, 'complex(u" 3.14+J )"' class Z: def __complex__(self): return 3.14j z = Z() -if complex(z) <> 3.14j: raise TestFailed, 'complex(classinstance)' +if complex(z) != 3.14j: raise TestFailed, 'complex(classinstance)' print 'delattr' import sys @@ -124,20 +124,20 @@ import sys if 'modules' not in dir(sys): raise TestFailed, 'dir(sys)' print 'divmod' -if divmod(12, 7) <> (1, 5): raise TestFailed, 'divmod(12, 7)' -if divmod(-12, 7) <> (-2, 2): raise TestFailed, 'divmod(-12, 7)' -if divmod(12, -7) <> (-2, -2): raise TestFailed, 'divmod(12, -7)' -if divmod(-12, -7) <> (1, -5): raise TestFailed, 'divmod(-12, -7)' +if divmod(12, 7) != (1, 5): raise TestFailed, 'divmod(12, 7)' +if divmod(-12, 7) != (-2, 2): raise TestFailed, 'divmod(-12, 7)' +if divmod(12, -7) != (-2, -2): raise TestFailed, 'divmod(12, -7)' +if divmod(-12, -7) != (1, -5): raise TestFailed, 'divmod(-12, -7)' # -if divmod(12L, 7L) <> (1L, 5L): raise TestFailed, 'divmod(12L, 7L)' -if divmod(-12L, 7L) <> (-2L, 2L): raise TestFailed, 'divmod(-12L, 7L)' -if divmod(12L, -7L) <> (-2L, -2L): raise TestFailed, 'divmod(12L, -7L)' -if divmod(-12L, -7L) <> (1L, -5L): raise TestFailed, 'divmod(-12L, -7L)' +if divmod(12L, 7L) != (1L, 5L): raise TestFailed, 'divmod(12L, 7L)' +if divmod(-12L, 7L) != (-2L, 2L): raise TestFailed, 'divmod(-12L, 7L)' +if divmod(12L, -7L) != (-2L, -2L): raise TestFailed, 'divmod(12L, -7L)' +if divmod(-12L, -7L) != (1L, -5L): raise TestFailed, 'divmod(-12L, -7L)' # -if divmod(12, 7L) <> (1, 5L): raise TestFailed, 'divmod(12, 7L)' -if divmod(-12, 7L) <> (-2, 2L): raise TestFailed, 'divmod(-12, 7L)' -if divmod(12L, -7) <> (-2L, -2): raise TestFailed, 'divmod(12L, -7)' -if divmod(-12L, -7) <> (1L, -5): raise TestFailed, 'divmod(-12L, -7)' +if divmod(12, 7L) != (1, 5L): raise TestFailed, 'divmod(12, 7L)' +if divmod(-12, 7L) != (-2, 2L): raise TestFailed, 'divmod(-12, 7L)' +if divmod(12L, -7) != (-2L, -2): raise TestFailed, 'divmod(12L, -7)' +if divmod(-12L, -7) != (1L, -5): raise TestFailed, 'divmod(-12L, -7)' # if fcmp(divmod(3.25, 1.0), (3.0, 0.25)): raise TestFailed, 'divmod(3.25, 1.0)' @@ -149,29 +149,29 @@ if fcmp(divmod(-3.25, -1.0), (3.0, -0.25)): raise TestFailed, 'divmod(-3.25, -1.0)' print 'eval' -if eval('1+1') <> 2: raise TestFailed, 'eval(\'1+1\')' -if eval(' 1+1\n') <> 2: raise TestFailed, 'eval(\' 1+1\\n\')' +if eval('1+1') != 2: raise TestFailed, 'eval(\'1+1\')' +if eval(' 1+1\n') != 2: raise TestFailed, 'eval(\' 1+1\\n\')' globals = {'a': 1, 'b': 2} locals = {'b': 200, 'c': 300} -if eval('a', globals) <> 1: +if eval('a', globals) != 1: raise TestFailed, "eval(1) == %s" % eval('a', globals) -if eval('a', globals, locals) <> 1: +if eval('a', globals, locals) != 1: raise TestFailed, "eval(2)" -if eval('b', globals, locals) <> 200: +if eval('b', globals, locals) != 200: raise TestFailed, "eval(3)" -if eval('c', globals, locals) <> 300: +if eval('c', globals, locals) != 300: raise TestFailed, "eval(4)" -if eval(u'1+1') <> 2: raise TestFailed, 'eval(u\'1+1\')' -if eval(u' 1+1\n') <> 2: raise TestFailed, 'eval(u\' 1+1\\n\')' +if eval(u'1+1') != 2: raise TestFailed, 'eval(u\'1+1\')' +if eval(u' 1+1\n') != 2: raise TestFailed, 'eval(u\' 1+1\\n\')' globals = {'a': 1, 'b': 2} locals = {'b': 200, 'c': 300} -if eval(u'a', globals) <> 1: +if eval(u'a', globals) != 1: raise TestFailed, "eval(1) == %s" % eval(u'a', globals) -if eval(u'a', globals, locals) <> 1: +if eval(u'a', globals, locals) != 1: raise TestFailed, "eval(2)" -if eval(u'b', globals, locals) <> 200: +if eval(u'b', globals, locals) != 200: raise TestFailed, "eval(3)" -if eval(u'c', globals, locals) <> 300: +if eval(u'c', globals, locals) != 300: raise TestFailed, "eval(4)" print 'execfile' @@ -181,21 +181,21 @@ f.write('z = z+1\n') f.write('z = z*2\n') f.close() execfile(TESTFN) -if z <> 2: raise TestFailed, "execfile(1)" +if z != 2: raise TestFailed, "execfile(1)" globals['z'] = 0 execfile(TESTFN, globals) -if globals['z'] <> 2: raise TestFailed, "execfile(1)" +if globals['z'] != 2: raise TestFailed, "execfile(1)" locals['z'] = 0 execfile(TESTFN, globals, locals) -if locals['z'] <> 2: raise TestFailed, "execfile(1)" +if locals['z'] != 2: raise TestFailed, "execfile(1)" unlink(TESTFN) print 'filter' -if filter(lambda c: 'a' <= c <= 'z', 'Hello World') <> 'elloorld': +if filter(lambda c: 'a' <= c <= 'z', 'Hello World') != 'elloorld': raise TestFailed, 'filter (filter a string)' -if filter(None, [1, 'hello', [], [3], '', None, 9, 0]) <> [1, 'hello', [3], 9]: +if filter(None, [1, 'hello', [], [3], '', None, 9, 0]) != [1, 'hello', [3], 9]: raise TestFailed, 'filter (remove false values)' -if filter(lambda x: x > 0, [1, -3, 9, 0, 2]) <> [1, 9, 2]: +if filter(lambda x: x > 0, [1, -3, 9, 0, 2]) != [1, 9, 2]: raise TestFailed, 'filter (keep positives)' class Squares: def __init__(self, max): @@ -232,12 +232,12 @@ def identity(item): filter(identity, Squares(5)) print 'float' -if float(3.14) <> 3.14: raise TestFailed, 'float(3.14)' -if float(314) <> 314.0: raise TestFailed, 'float(314)' -if float(314L) <> 314.0: raise TestFailed, 'float(314L)' -if float(" 3.14 ") <> 3.14: raise TestFailed, 'float(" 3.14 ")' -if float(u" 3.14 ") <> 3.14: raise TestFailed, 'float(u" 3.14 ")' -if float(u" \u0663.\u0661\u0664 ") <> 3.14: +if float(3.14) != 3.14: raise TestFailed, 'float(3.14)' +if float(314) != 314.0: raise TestFailed, 'float(314)' +if float(314L) != 314.0: raise TestFailed, 'float(314L)' +if float(" 3.14 ") != 3.14: raise TestFailed, 'float(" 3.14 ")' +if float(u" 3.14 ") != 3.14: raise TestFailed, 'float(u" 3.14 ")' +if float(u" \u0663.\u0661\u0664 ") != 3.14: raise TestFailed, 'float(u" \u0663.\u0661\u0664 ")' print 'getattr' @@ -276,18 +276,18 @@ id({'spam': 1, 'eggs': 2, 'ham': 3}) # Test input() later, together with raw_input print 'int' -if int(314) <> 314: raise TestFailed, 'int(314)' -if int(3.14) <> 3: raise TestFailed, 'int(3.14)' -if int(314L) <> 314: raise TestFailed, 'int(314L)' +if int(314) != 314: raise TestFailed, 'int(314)' +if int(3.14) != 3: raise TestFailed, 'int(3.14)' +if int(314L) != 314: raise TestFailed, 'int(314L)' # Check that conversion from float truncates towards zero -if int(-3.14) <> -3: raise TestFailed, 'int(-3.14)' -if int(3.9) <> 3: raise TestFailed, 'int(3.9)' -if int(-3.9) <> -3: raise TestFailed, 'int(-3.9)' -if int(3.5) <> 3: raise TestFailed, 'int(3.5)' -if int(-3.5) <> -3: raise TestFailed, 'int(-3.5)' +if int(-3.14) != -3: raise TestFailed, 'int(-3.14)' +if int(3.9) != 3: raise TestFailed, 'int(3.9)' +if int(-3.9) != -3: raise TestFailed, 'int(-3.9)' +if int(3.5) != 3: raise TestFailed, 'int(3.5)' +if int(-3.5) != -3: raise TestFailed, 'int(-3.5)' # Different base: -if int("10",16) <> 16L: raise TestFailed, 'int("10",16)' -if int(u"10",16) <> 16L: raise TestFailed, 'int(u"10",16)' +if int("10",16) != 16L: raise TestFailed, 'int("10",16)' +if int(u"10",16) != 16L: raise TestFailed, 'int(u"10",16)' # Test conversion from strings and various anomalies L = [ ('0', 0), @@ -385,28 +385,28 @@ except TypeError: pass print 'len' -if len('123') <> 3: raise TestFailed, 'len(\'123\')' -if len(()) <> 0: raise TestFailed, 'len(())' -if len((1, 2, 3, 4)) <> 4: raise TestFailed, 'len((1, 2, 3, 4))' -if len([1, 2, 3, 4]) <> 4: raise TestFailed, 'len([1, 2, 3, 4])' -if len({}) <> 0: raise TestFailed, 'len({})' -if len({'a':1, 'b': 2}) <> 2: raise TestFailed, 'len({\'a\':1, \'b\': 2})' +if len('123') != 3: raise TestFailed, 'len(\'123\')' +if len(()) != 0: raise TestFailed, 'len(())' +if len((1, 2, 3, 4)) != 4: raise TestFailed, 'len((1, 2, 3, 4))' +if len([1, 2, 3, 4]) != 4: raise TestFailed, 'len([1, 2, 3, 4])' +if len({}) != 0: raise TestFailed, 'len({})' +if len({'a':1, 'b': 2}) != 2: raise TestFailed, 'len({\'a\':1, \'b\': 2})' print 'long' -if long(314) <> 314L: raise TestFailed, 'long(314)' -if long(3.14) <> 3L: raise TestFailed, 'long(3.14)' -if long(314L) <> 314L: raise TestFailed, 'long(314L)' +if long(314) != 314L: raise TestFailed, 'long(314)' +if long(3.14) != 3L: raise TestFailed, 'long(3.14)' +if long(314L) != 314L: raise TestFailed, 'long(314L)' # Check that conversion from float truncates towards zero -if long(-3.14) <> -3L: raise TestFailed, 'long(-3.14)' -if long(3.9) <> 3L: raise TestFailed, 'long(3.9)' -if long(-3.9) <> -3L: raise TestFailed, 'long(-3.9)' -if long(3.5) <> 3L: raise TestFailed, 'long(3.5)' -if long(-3.5) <> -3L: raise TestFailed, 'long(-3.5)' -if long("-3") <> -3L: raise TestFailed, 'long("-3")' -if long(u"-3") <> -3L: raise TestFailed, 'long(u"-3")' +if long(-3.14) != -3L: raise TestFailed, 'long(-3.14)' +if long(3.9) != 3L: raise TestFailed, 'long(3.9)' +if long(-3.9) != -3L: raise TestFailed, 'long(-3.9)' +if long(3.5) != 3L: raise TestFailed, 'long(3.5)' +if long(-3.5) != -3L: raise TestFailed, 'long(-3.5)' +if long("-3") != -3L: raise TestFailed, 'long("-3")' +if long(u"-3") != -3L: raise TestFailed, 'long(u"-3")' # Different base: -if long("10",16) <> 16L: raise TestFailed, 'long("10",16)' -if long(u"10",16) <> 16L: raise TestFailed, 'long(u"10",16)' +if long("10",16) != 16L: raise TestFailed, 'long("10",16)' +if long(u"10",16) != 16L: raise TestFailed, 'long(u"10",16)' # Check conversions from string (same test set as for int(), and then some) LL = [ ('1' + '0'*20, 10L**20), @@ -430,33 +430,33 @@ for s, v in L + LL: raise TestFailed, "long(%s) raised ValueError: %s" % (`ss`, e) print 'map' -if map(None, 'hello world') <> ['h','e','l','l','o',' ','w','o','r','l','d']: +if map(None, 'hello world') != ['h','e','l','l','o',' ','w','o','r','l','d']: raise TestFailed, 'map(None, \'hello world\')' -if map(None, 'abcd', 'efg') <> \ +if map(None, 'abcd', 'efg') != \ [('a', 'e'), ('b', 'f'), ('c', 'g'), ('d', None)]: raise TestFailed, 'map(None, \'abcd\', \'efg\')' -if map(None, range(10)) <> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]: +if map(None, range(10)) != [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]: raise TestFailed, 'map(None, range(10))' -if map(lambda x: x*x, range(1,4)) <> [1, 4, 9]: +if map(lambda x: x*x, range(1,4)) != [1, 4, 9]: raise TestFailed, 'map(lambda x: x*x, range(1,4))' try: from math import sqrt except ImportError: def sqrt(x): return pow(x, 0.5) -if map(lambda x: map(sqrt,x), [[16, 4], [81, 9]]) <> [[4.0, 2.0], [9.0, 3.0]]: +if map(lambda x: map(sqrt,x), [[16, 4], [81, 9]]) != [[4.0, 2.0], [9.0, 3.0]]: raise TestFailed, 'map(lambda x: map(sqrt,x), [[16, 4], [81, 9]])' -if map(lambda x, y: x+y, [1,3,2], [9,1,4]) <> [10, 4, 6]: +if map(lambda x, y: x+y, [1,3,2], [9,1,4]) != [10, 4, 6]: raise TestFailed, 'map(lambda x,y: x+y, [1,3,2], [9,1,4])' def plus(*v): accu = 0 for i in v: accu = accu + i return accu -if map(plus, [1, 3, 7]) <> [1, 3, 7]: +if map(plus, [1, 3, 7]) != [1, 3, 7]: raise TestFailed, 'map(plus, [1, 3, 7])' -if map(plus, [1, 3, 7], [4, 9, 2]) <> [1+4, 3+9, 7+2]: +if map(plus, [1, 3, 7], [4, 9, 2]) != [1+4, 3+9, 7+2]: raise TestFailed, 'map(plus, [1, 3, 7], [4, 9, 2])' -if map(plus, [1, 3, 7], [4, 9, 2], [1, 1, 0]) <> [1+4+1, 3+9+1, 7+2+0]: +if map(plus, [1, 3, 7], [4, 9, 2], [1, 1, 0]) != [1+4+1, 3+9+1, 7+2+0]: raise TestFailed, 'map(plus, [1, 3, 7], [4, 9, 2], [1, 1, 0])' if map(None, Squares(10)) != [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]: raise TestFailed, 'map(None, Squares(10))' @@ -468,21 +468,21 @@ if map(max, Squares(3), Squares(2)) != [0, 1, None]: raise TestFailed, 'map(max, Squares(3), Squares(2))' print 'max' -if max('123123') <> '3': raise TestFailed, 'max(\'123123\')' -if max(1, 2, 3) <> 3: raise TestFailed, 'max(1, 2, 3)' -if max((1, 2, 3, 1, 2, 3)) <> 3: raise TestFailed, 'max((1, 2, 3, 1, 2, 3))' -if max([1, 2, 3, 1, 2, 3]) <> 3: raise TestFailed, 'max([1, 2, 3, 1, 2, 3])' +if max('123123') != '3': raise TestFailed, 'max(\'123123\')' +if max(1, 2, 3) != 3: raise TestFailed, 'max(1, 2, 3)' +if max((1, 2, 3, 1, 2, 3)) != 3: raise TestFailed, 'max((1, 2, 3, 1, 2, 3))' +if max([1, 2, 3, 1, 2, 3]) != 3: raise TestFailed, 'max([1, 2, 3, 1, 2, 3])' # -if max(1, 2L, 3.0) <> 3.0: raise TestFailed, 'max(1, 2L, 3.0)' -if max(1L, 2.0, 3) <> 3: raise TestFailed, 'max(1L, 2.0, 3)' -if max(1.0, 2, 3L) <> 3L: raise TestFailed, 'max(1.0, 2, 3L)' +if max(1, 2L, 3.0) != 3.0: raise TestFailed, 'max(1, 2L, 3.0)' +if max(1L, 2.0, 3) != 3: raise TestFailed, 'max(1L, 2.0, 3)' +if max(1.0, 2, 3L) != 3L: raise TestFailed, 'max(1.0, 2, 3L)' print 'min' -if min('123123') <> '1': raise TestFailed, 'min(\'123123\')' -if min(1, 2, 3) <> 1: raise TestFailed, 'min(1, 2, 3)' -if min((1, 2, 3, 1, 2, 3)) <> 1: raise TestFailed, 'min((1, 2, 3, 1, 2, 3))' -if min([1, 2, 3, 1, 2, 3]) <> 1: raise TestFailed, 'min([1, 2, 3, 1, 2, 3])' +if min('123123') != '1': raise TestFailed, 'min(\'123123\')' +if min(1, 2, 3) != 1: raise TestFailed, 'min(1, 2, 3)' +if min((1, 2, 3, 1, 2, 3)) != 1: raise TestFailed, 'min((1, 2, 3, 1, 2, 3))' +if min([1, 2, 3, 1, 2, 3]) != 1: raise TestFailed, 'min([1, 2, 3, 1, 2, 3])' # -if min(1, 2L, 3.0) <> 1: raise TestFailed, 'min(1, 2L, 3.0)' -if min(1L, 2.0, 3) <> 1L: raise TestFailed, 'min(1L, 2.0, 3)' -if min(1.0, 2, 3L) <> 1.0: raise TestFailed, 'min(1.0, 2, 3L)' +if min(1, 2L, 3.0) != 1: raise TestFailed, 'min(1, 2L, 3.0)' +if min(1L, 2.0, 3) != 1L: raise TestFailed, 'min(1L, 2.0, 3)' +if min(1.0, 2, 3L) != 1.0: raise TestFailed, 'min(1.0, 2, 3L)' diff --git a/Lib/test/test_b2.py b/Lib/test/test_b2.py index c212f2e..5546d8a 100644 --- a/Lib/test/test_b2.py +++ b/Lib/test/test_b2.py @@ -25,52 +25,52 @@ finally: # fp = open(TESTFN, 'r') try: - if fp.readline(4) <> '1+1\n': raise TestFailed, 'readline(4) # exact' - if fp.readline(4) <> '1+1\n': raise TestFailed, 'readline(4) # exact' - if fp.readline() <> 'The quick brown fox jumps over the lazy dog.\n': + if fp.readline(4) != '1+1\n': raise TestFailed, 'readline(4) # exact' + if fp.readline(4) != '1+1\n': raise TestFailed, 'readline(4) # exact' + if fp.readline() != 'The quick brown fox jumps over the lazy dog.\n': raise TestFailed, 'readline() # default' - if fp.readline(4) <> 'Dear': raise TestFailed, 'readline(4) # short' - if fp.readline(100) <> ' John\n': raise TestFailed, 'readline(100)' - if fp.read(300) <> 'XXX'*100: raise TestFailed, 'read(300)' - if fp.read(1000) <> 'YYY'*100: raise TestFailed, 'read(1000) # truncate' + if fp.readline(4) != 'Dear': raise TestFailed, 'readline(4) # short' + if fp.readline(100) != ' John\n': raise TestFailed, 'readline(100)' + if fp.read(300) != 'XXX'*100: raise TestFailed, 'read(300)' + if fp.read(1000) != 'YYY'*100: raise TestFailed, 'read(1000) # truncate' finally: fp.close() print 'ord' -if ord(' ') <> 32: raise TestFailed, 'ord(\' \')' -if ord('A') <> 65: raise TestFailed, 'ord(\'A\')' -if ord('a') <> 97: raise TestFailed, 'ord(\'a\')' +if ord(' ') != 32: raise TestFailed, 'ord(\' \')' +if ord('A') != 65: raise TestFailed, 'ord(\'A\')' +if ord('a') != 97: raise TestFailed, 'ord(\'a\')' print 'pow' -if pow(0,0) <> 1: raise TestFailed, 'pow(0,0)' -if pow(0,1) <> 0: raise TestFailed, 'pow(0,1)' -if pow(1,0) <> 1: raise TestFailed, 'pow(1,0)' -if pow(1,1) <> 1: raise TestFailed, 'pow(1,1)' +if pow(0,0) != 1: raise TestFailed, 'pow(0,0)' +if pow(0,1) != 0: raise TestFailed, 'pow(0,1)' +if pow(1,0) != 1: raise TestFailed, 'pow(1,0)' +if pow(1,1) != 1: raise TestFailed, 'pow(1,1)' # -if pow(2,0) <> 1: raise TestFailed, 'pow(2,0)' -if pow(2,10) <> 1024: raise TestFailed, 'pow(2,10)' -if pow(2,20) <> 1024*1024: raise TestFailed, 'pow(2,20)' -if pow(2,30) <> 1024*1024*1024: raise TestFailed, 'pow(2,30)' +if pow(2,0) != 1: raise TestFailed, 'pow(2,0)' +if pow(2,10) != 1024: raise TestFailed, 'pow(2,10)' +if pow(2,20) != 1024*1024: raise TestFailed, 'pow(2,20)' +if pow(2,30) != 1024*1024*1024: raise TestFailed, 'pow(2,30)' # -if pow(-2,0) <> 1: raise TestFailed, 'pow(-2,0)' -if pow(-2,1) <> -2: raise TestFailed, 'pow(-2,1)' -if pow(-2,2) <> 4: raise TestFailed, 'pow(-2,2)' -if pow(-2,3) <> -8: raise TestFailed, 'pow(-2,3)' +if pow(-2,0) != 1: raise TestFailed, 'pow(-2,0)' +if pow(-2,1) != -2: raise TestFailed, 'pow(-2,1)' +if pow(-2,2) != 4: raise TestFailed, 'pow(-2,2)' +if pow(-2,3) != -8: raise TestFailed, 'pow(-2,3)' # -if pow(0L,0) <> 1: raise TestFailed, 'pow(0L,0)' -if pow(0L,1) <> 0: raise TestFailed, 'pow(0L,1)' -if pow(1L,0) <> 1: raise TestFailed, 'pow(1L,0)' -if pow(1L,1) <> 1: raise TestFailed, 'pow(1L,1)' +if pow(0L,0) != 1: raise TestFailed, 'pow(0L,0)' +if pow(0L,1) != 0: raise TestFailed, 'pow(0L,1)' +if pow(1L,0) != 1: raise TestFailed, 'pow(1L,0)' +if pow(1L,1) != 1: raise TestFailed, 'pow(1L,1)' # -if pow(2L,0) <> 1: raise TestFailed, 'pow(2L,0)' -if pow(2L,10) <> 1024: raise TestFailed, 'pow(2L,10)' -if pow(2L,20) <> 1024*1024: raise TestFailed, 'pow(2L,20)' -if pow(2L,30) <> 1024*1024*1024: raise TestFailed, 'pow(2L,30)' +if pow(2L,0) != 1: raise TestFailed, 'pow(2L,0)' +if pow(2L,10) != 1024: raise TestFailed, 'pow(2L,10)' +if pow(2L,20) != 1024*1024: raise TestFailed, 'pow(2L,20)' +if pow(2L,30) != 1024*1024*1024: raise TestFailed, 'pow(2L,30)' # -if pow(-2L,0) <> 1: raise TestFailed, 'pow(-2L,0)' -if pow(-2L,1) <> -2: raise TestFailed, 'pow(-2L,1)' -if pow(-2L,2) <> 4: raise TestFailed, 'pow(-2L,2)' -if pow(-2L,3) <> -8: raise TestFailed, 'pow(-2L,3)' +if pow(-2L,0) != 1: raise TestFailed, 'pow(-2L,0)' +if pow(-2L,1) != -2: raise TestFailed, 'pow(-2L,1)' +if pow(-2L,2) != 4: raise TestFailed, 'pow(-2L,2)' +if pow(-2L,3) != -8: raise TestFailed, 'pow(-2L,3)' # if fcmp(pow(0.,0), 1.): raise TestFailed, 'pow(0.,0)' if fcmp(pow(0.,1), 0.): raise TestFailed, 'pow(0.,1)' @@ -95,12 +95,12 @@ for x in 2, 2L, 2.0: raise TestFailed, 'pow(%s, %s, %s)' % (x, y, z) print 'range' -if range(3) <> [0, 1, 2]: raise TestFailed, 'range(3)' -if range(1, 5) <> [1, 2, 3, 4]: raise TestFailed, 'range(1, 5)' -if range(0) <> []: raise TestFailed, 'range(0)' -if range(-3) <> []: raise TestFailed, 'range(-3)' -if range(1, 10, 3) <> [1, 4, 7]: raise TestFailed, 'range(1, 10, 3)' -if range(5, -5, -3) <> [5, 2, -1, -4]: raise TestFailed, 'range(5, -5, -3)' +if range(3) != [0, 1, 2]: raise TestFailed, 'range(3)' +if range(1, 5) != [1, 2, 3, 4]: raise TestFailed, 'range(1, 5)' +if range(0) != []: raise TestFailed, 'range(0)' +if range(-3) != []: raise TestFailed, 'range(-3)' +if range(1, 10, 3) != [1, 4, 7]: raise TestFailed, 'range(1, 10, 3)' +if range(5, -5, -3) != [5, 2, -1, -4]: raise TestFailed, 'range(5, -5, -3)' print 'input and raw_input' import sys @@ -108,25 +108,25 @@ fp = open(TESTFN, 'r') savestdin = sys.stdin try: sys.stdin = fp - if input() <> 2: raise TestFailed, 'input()' - if input('testing\n') <> 2: raise TestFailed, 'input()' - if raw_input() <> 'The quick brown fox jumps over the lazy dog.': + if input() != 2: raise TestFailed, 'input()' + if input('testing\n') != 2: raise TestFailed, 'input()' + if raw_input() != 'The quick brown fox jumps over the lazy dog.': raise TestFailed, 'raw_input()' - if raw_input('testing\n') <> 'Dear John': + if raw_input('testing\n') != 'Dear John': raise TestFailed, 'raw_input(\'testing\\n\')' finally: sys.stdin = savestdin fp.close() print 'reduce' -if reduce(lambda x, y: x+y, ['a', 'b', 'c'], '') <> 'abc': +if reduce(lambda x, y: x+y, ['a', 'b', 'c'], '') != 'abc': raise TestFailed, 'reduce(): implode a string' if reduce(lambda x, y: x+y, - [['a', 'c'], [], ['d', 'w']], []) <> ['a','c','d','w']: + [['a', 'c'], [], ['d', 'w']], []) != ['a','c','d','w']: raise TestFailed, 'reduce(): append' -if reduce(lambda x, y: x*y, range(2,8), 1) <> 5040: +if reduce(lambda x, y: x*y, range(2,8), 1) != 5040: raise TestFailed, 'reduce(): compute 7!' -if reduce(lambda x, y: x*y, range(2,21), 1L) <> 2432902008176640000L: +if reduce(lambda x, y: x*y, range(2,21), 1L) != 2432902008176640000L: raise TestFailed, 'reduce(): compute 20!, use long' class Squares: def __init__(self, max): @@ -159,46 +159,46 @@ reload(string) ## else: raise TestFailed, 'reload(sys) should fail' print 'repr' -if repr('') <> '\'\'': raise TestFailed, 'repr(\'\')' -if repr(0) <> '0': raise TestFailed, 'repr(0)' -if repr(0L) <> '0L': raise TestFailed, 'repr(0L)' -if repr(()) <> '()': raise TestFailed, 'repr(())' -if repr([]) <> '[]': raise TestFailed, 'repr([])' -if repr({}) <> '{}': raise TestFailed, 'repr({})' +if repr('') != '\'\'': raise TestFailed, 'repr(\'\')' +if repr(0) != '0': raise TestFailed, 'repr(0)' +if repr(0L) != '0L': raise TestFailed, 'repr(0L)' +if repr(()) != '()': raise TestFailed, 'repr(())' +if repr([]) != '[]': raise TestFailed, 'repr([])' +if repr({}) != '{}': raise TestFailed, 'repr({})' print 'round' -if round(0.0) <> 0.0: raise TestFailed, 'round(0.0)' -if round(1.0) <> 1.0: raise TestFailed, 'round(1.0)' -if round(10.0) <> 10.0: raise TestFailed, 'round(10.0)' -if round(1000000000.0) <> 1000000000.0: +if round(0.0) != 0.0: raise TestFailed, 'round(0.0)' +if round(1.0) != 1.0: raise TestFailed, 'round(1.0)' +if round(10.0) != 10.0: raise TestFailed, 'round(10.0)' +if round(1000000000.0) != 1000000000.0: raise TestFailed, 'round(1000000000.0)' -if round(1e20) <> 1e20: raise TestFailed, 'round(1e20)' +if round(1e20) != 1e20: raise TestFailed, 'round(1e20)' -if round(-1.0) <> -1.0: raise TestFailed, 'round(-1.0)' -if round(-10.0) <> -10.0: raise TestFailed, 'round(-10.0)' -if round(-1000000000.0) <> -1000000000.0: +if round(-1.0) != -1.0: raise TestFailed, 'round(-1.0)' +if round(-10.0) != -10.0: raise TestFailed, 'round(-10.0)' +if round(-1000000000.0) != -1000000000.0: raise TestFailed, 'round(-1000000000.0)' -if round(-1e20) <> -1e20: raise TestFailed, 'round(-1e20)' +if round(-1e20) != -1e20: raise TestFailed, 'round(-1e20)' -if round(0.1) <> 0.0: raise TestFailed, 'round(0.0)' -if round(1.1) <> 1.0: raise TestFailed, 'round(1.0)' -if round(10.1) <> 10.0: raise TestFailed, 'round(10.0)' -if round(1000000000.1) <> 1000000000.0: +if round(0.1) != 0.0: raise TestFailed, 'round(0.0)' +if round(1.1) != 1.0: raise TestFailed, 'round(1.0)' +if round(10.1) != 10.0: raise TestFailed, 'round(10.0)' +if round(1000000000.1) != 1000000000.0: raise TestFailed, 'round(1000000000.0)' -if round(-1.1) <> -1.0: raise TestFailed, 'round(-1.0)' -if round(-10.1) <> -10.0: raise TestFailed, 'round(-10.0)' -if round(-1000000000.1) <> -1000000000.0: +if round(-1.1) != -1.0: raise TestFailed, 'round(-1.0)' +if round(-10.1) != -10.0: raise TestFailed, 'round(-10.0)' +if round(-1000000000.1) != -1000000000.0: raise TestFailed, 'round(-1000000000.0)' -if round(0.9) <> 1.0: raise TestFailed, 'round(0.9)' -if round(9.9) <> 10.0: raise TestFailed, 'round(9.9)' -if round(999999999.9) <> 1000000000.0: +if round(0.9) != 1.0: raise TestFailed, 'round(0.9)' +if round(9.9) != 10.0: raise TestFailed, 'round(9.9)' +if round(999999999.9) != 1000000000.0: raise TestFailed, 'round(999999999.9)' -if round(-0.9) <> -1.0: raise TestFailed, 'round(-0.9)' -if round(-9.9) <> -10.0: raise TestFailed, 'round(-9.9)' -if round(-999999999.9) <> -1000000000.0: +if round(-0.9) != -1.0: raise TestFailed, 'round(-0.9)' +if round(-9.9) != -10.0: raise TestFailed, 'round(-9.9)' +if round(-999999999.9) != -1000000000.0: raise TestFailed, 'round(-999999999.9)' print 'setattr' @@ -207,23 +207,23 @@ setattr(sys, 'spam', 1) if sys.spam != 1: raise TestFailed, 'setattr(sys, \'spam\', 1)' print 'str' -if str('') <> '': raise TestFailed, 'str(\'\')' -if str(0) <> '0': raise TestFailed, 'str(0)' -if str(0L) <> '0': raise TestFailed, 'str(0L)' -if str(()) <> '()': raise TestFailed, 'str(())' -if str([]) <> '[]': raise TestFailed, 'str([])' -if str({}) <> '{}': raise TestFailed, 'str({})' +if str('') != '': raise TestFailed, 'str(\'\')' +if str(0) != '0': raise TestFailed, 'str(0)' +if str(0L) != '0': raise TestFailed, 'str(0L)' +if str(()) != '()': raise TestFailed, 'str(())' +if str([]) != '[]': raise TestFailed, 'str([])' +if str({}) != '{}': raise TestFailed, 'str({})' print 'tuple' -if tuple(()) <> (): raise TestFailed, 'tuple(())' -if tuple((0, 1, 2, 3)) <> (0, 1, 2, 3): raise TestFailed, 'tuple((0, 1, 2, 3))' -if tuple([]) <> (): raise TestFailed, 'tuple([])' -if tuple([0, 1, 2, 3]) <> (0, 1, 2, 3): raise TestFailed, 'tuple([0, 1, 2, 3])' -if tuple('') <> (): raise TestFailed, 'tuple('')' -if tuple('spam') <> ('s', 'p', 'a', 'm'): raise TestFailed, "tuple('spam')" +if tuple(()) != (): raise TestFailed, 'tuple(())' +if tuple((0, 1, 2, 3)) != (0, 1, 2, 3): raise TestFailed, 'tuple((0, 1, 2, 3))' +if tuple([]) != (): raise TestFailed, 'tuple([])' +if tuple([0, 1, 2, 3]) != (0, 1, 2, 3): raise TestFailed, 'tuple([0, 1, 2, 3])' +if tuple('') != (): raise TestFailed, 'tuple('')' +if tuple('spam') != ('s', 'p', 'a', 'm'): raise TestFailed, "tuple('spam')" print 'type' -if type('') <> type('123') or type('') == type(()): +if type('') != type('123') or type('') == type(()): raise TestFailed, 'type()' print 'vars' @@ -232,13 +232,13 @@ a = vars().keys() b = dir() a.sort() b.sort() -if a <> b: raise TestFailed, 'vars()' +if a != b: raise TestFailed, 'vars()' import sys a = vars(sys).keys() b = dir(sys) a.sort() b.sort() -if a <> b: raise TestFailed, 'vars(sys)' +if a != b: raise TestFailed, 'vars(sys)' def f0(): if vars() != {}: raise TestFailed, 'vars() in f0()' f0() @@ -250,9 +250,9 @@ def f2(): f2() print 'xrange' -if tuple(xrange(10)) <> tuple(range(10)): raise TestFailed, 'xrange(10)' -if tuple(xrange(5,10)) <> tuple(range(5,10)): raise TestFailed, 'xrange(5,10)' -if tuple(xrange(0,10,2)) <> tuple(range(0,10,2)): +if tuple(xrange(10)) != tuple(range(10)): raise TestFailed, 'xrange(10)' +if tuple(xrange(5,10)) != tuple(range(5,10)): raise TestFailed, 'xrange(5,10)' +if tuple(xrange(0,10,2)) != tuple(range(0,10,2)): raise TestFailed, 'xrange(0,10,2)' # regression tests for SourceForge bug #121695 def _range_test(r): @@ -273,16 +273,16 @@ print 'zip' a = (1, 2, 3) b = (4, 5, 6) t = [(1, 4), (2, 5), (3, 6)] -if zip(a, b) <> t: raise TestFailed, 'zip(a, b) - same size, both tuples' +if zip(a, b) != t: raise TestFailed, 'zip(a, b) - same size, both tuples' b = [4, 5, 6] -if zip(a, b) <> t: raise TestFailed, 'zip(a, b) - same size, tuple/list' +if zip(a, b) != t: raise TestFailed, 'zip(a, b) - same size, tuple/list' b = (4, 5, 6, 7) -if zip(a, b) <> t: raise TestFailed, 'zip(a, b) - b is longer' +if zip(a, b) != t: raise TestFailed, 'zip(a, b) - b is longer' class I: def __getitem__(self, i): if i < 0 or i > 2: raise IndexError return i + 4 -if zip(a, I()) <> t: raise TestFailed, 'zip(a, b) - b is instance' +if zip(a, I()) != t: raise TestFailed, 'zip(a, b) - b is instance' exc = 0 try: zip() diff --git a/Lib/test/test_binascii.py b/Lib/test/test_binascii.py index 52f817b..20f5400 100755 --- a/Lib/test/test_binascii.py +++ b/Lib/test/test_binascii.py @@ -96,7 +96,7 @@ if crc != 1571220330: s = '{s\005\000\000\000worldi\002\000\000\000s\005\000\000\000helloi\001\000\000\0000' t = binascii.b2a_hex(s) u = binascii.a2b_hex(t) -if s <> u: +if s != u: print 'binascii hexlification failed' try: binascii.a2b_hex(t[:-1]) diff --git a/Lib/test/test_binhex.py b/Lib/test/test_binhex.py index 68012f8..4dfe14e 100755 --- a/Lib/test/test_binhex.py +++ b/Lib/test/test_binhex.py @@ -32,8 +32,8 @@ def test(): f = open(fname1, 'r') finish = f.readline() - if start <> finish: - print 'Error: binhex <> hexbin' + if start != finish: + print 'Error: binhex != hexbin' elif verbose: print 'binhex == hexbin' diff --git a/Lib/test/test_bsddb.py b/Lib/test/test_bsddb.py index aa65295..b59a4e0 100755 --- a/Lib/test/test_bsddb.py +++ b/Lib/test/test_bsddb.py @@ -34,8 +34,8 @@ def test(openmethod, what): try: rec = f.next() except KeyError: - if rec <> f.last(): - print 'Error, last <> last!' + if rec != f.last(): + print 'Error, last != last!' f.previous() break if verbose: diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py index 7dcad07..b990c83 100644 --- a/Lib/test/test_grammar.py +++ b/Lib/test/test_grammar.py @@ -12,17 +12,17 @@ print '1.1.1 Backslashes' # Backslash means line continuation: x = 1 \ + 1 -if x <> 2: raise TestFailed, 'backslash for line continuation' +if x != 2: raise TestFailed, 'backslash for line continuation' # Backslash does not means continuation in comments :\ x = 0 -if x <> 0: raise TestFailed, 'backslash ending comment' +if x != 0: raise TestFailed, 'backslash ending comment' print '1.1.2 Numeric literals' print '1.1.2.1 Plain integers' -if 0xff <> 255: raise TestFailed, 'hex int' -if 0377 <> 255: raise TestFailed, 'octal int' +if 0xff != 255: raise TestFailed, 'hex int' +if 0377 != 255: raise TestFailed, 'octal int' if 2147483647 != 017777777777: raise TestFailed, 'large positive int' try: from sys import maxint @@ -359,28 +359,28 @@ def f(): z = None del z exec 'z=1+1\n' - if z <> 2: raise TestFailed, 'exec \'z=1+1\'\\n' + if z != 2: raise TestFailed, 'exec \'z=1+1\'\\n' del z exec 'z=1+1' - if z <> 2: raise TestFailed, 'exec \'z=1+1\'' + if z != 2: raise TestFailed, 'exec \'z=1+1\'' z = None del z exec u'z=1+1\n' - if z <> 2: raise TestFailed, 'exec u\'z=1+1\'\\n' + if z != 2: raise TestFailed, 'exec u\'z=1+1\'\\n' del z exec u'z=1+1' - if z <> 2: raise TestFailed, 'exec u\'z=1+1\'' + if z != 2: raise TestFailed, 'exec u\'z=1+1\'' f() g = {} exec 'z = 1' in g if g.has_key('__builtins__'): del g['__builtins__'] -if g <> {'z': 1}: raise TestFailed, 'exec \'z = 1\' in g' +if g != {'z': 1}: raise TestFailed, 'exec \'z = 1\' in g' g = {} l = {} exec 'global a; a = 1; b = 2' in g, l if g.has_key('__builtins__'): del g['__builtins__'] if l.has_key('__builtins__'): del l['__builtins__'] -if (g, l) <> ({'a':1}, {'b':2}): raise TestFailed, 'exec ... in g, l' +if (g, l) != ({'a':1}, {'b':2}): raise TestFailed, 'exec ... in g, l' ### compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | funcdef | classdef diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py index 888d277..8419a1f 100644 --- a/Lib/test/test_math.py +++ b/Lib/test/test_math.py @@ -85,7 +85,7 @@ testit('fmod(-10,1.5)', math.fmod(-10,1.5), -1) print 'frexp' def testfrexp(name, (mant, exp), (emant, eexp)): - if abs(mant-emant) > eps or exp <> eexp: + if abs(mant-emant) > eps or exp != eexp: raise TestFailed, '%s returned %s, expected %s'%\ (name, `mant, exp`, `emant,eexp`) diff --git a/Lib/test/test_md5.py b/Lib/test/test_md5.py index e2d3f22..92cd568 100644 --- a/Lib/test/test_md5.py +++ b/Lib/test/test_md5.py @@ -26,5 +26,5 @@ print md5test('12345678901234567890123456789012345678901234567890123456789012345 # hexdigest is new with Python 2.0 m = md5('testing the hexdigest method') h = m.hexdigest() -if hexstr(m.digest()) <> h: +if hexstr(m.digest()) != h: print 'hexdigest() failed' diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py index 3e2d89f..d07e4c6 100644 --- a/Lib/test/test_mmap.py +++ b/Lib/test/test_mmap.py @@ -46,7 +46,7 @@ def test_both(): # Test doing a regular expression match in an mmap'ed file match=re.search('[A-Za-z]+', m) - if match == None: + if match is None: print ' ERROR: regex match on mmap failed!' else: start, end = match.span(0) diff --git a/Lib/test/test_new.py b/Lib/test/test_new.py index a693d8b..70ea38b 100644 --- a/Lib/test/test_new.py +++ b/Lib/test/test_new.py @@ -33,10 +33,10 @@ im = new.instancemethod(break_yolks, c, C) if verbose: print im -if c.get_yolks() <> 3 and c.get_more_yolks() <> 6: +if c.get_yolks() != 3 and c.get_more_yolks() != 6: print 'Broken call of hand-crafted class instance' im() -if c.get_yolks() <> 1 and c.get_more_yolks() <> 4: +if c.get_yolks() != 1 and c.get_more_yolks() != 4: print 'Broken call of hand-crafted instance method' codestr = ''' @@ -53,7 +53,7 @@ func = new.function(ccode, g) if verbose: print func func() -if g['c'] <> 3: +if g['c'] != 3: print 'Could not create a proper function object' # bogus test of new.code() diff --git a/Lib/test/test_nis.py b/Lib/test/test_nis.py index f711de0..e1670d1 100644 --- a/Lib/test/test_nis.py +++ b/Lib/test/test_nis.py @@ -21,7 +21,7 @@ for nismap in maps: print ' ', k, v if not k: continue - if nis.match(k, nismap) <> v: + 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 diff --git a/Lib/test/test_opcodes.py b/Lib/test/test_opcodes.py index 94a0a92..5381e4d 100644 --- a/Lib/test/test_opcodes.py +++ b/Lib/test/test_opcodes.py @@ -19,7 +19,7 @@ for i in range(10): try: pass finally: pass n = n+i -if n <> 90: +if n != 90: raise TestFailed, 'try inside for' diff --git a/Lib/test/test_operator.py b/Lib/test/test_operator.py index 8d3864c..b75c5ba 100644 --- a/Lib/test/test_operator.py +++ b/Lib/test/test_operator.py @@ -9,7 +9,7 @@ def test(name, input, output, *args): val = apply(f, params) except: val = sys.exc_type - if val <> output: + if val != output: print '%s%s = %s: %s expected' % (f.__name__, params, `val`, `output`) test('abs', -1, 1) @@ -21,12 +21,12 @@ test('countOf', [1, 2, 1, 3, 1, 4], 1, 3) a = [4, 3, 2, 1] test('delitem', a, None, 1) -if a <> [4, 2, 1]: +if a != [4, 2, 1]: print 'delitem() failed' a = range(10) test('delslice', a, None, 2, 8) -if a <> [0, 1, 8, 9]: +if a != [0, 1, 8, 9]: print 'delslice() failed' a = range(10) @@ -59,12 +59,12 @@ test('sequenceIncludes', range(4), 1, 2) test('sequenceIncludes', range(4), 0, 5) test('setitem', a, None, 0, 2) -if a <> [2, 1, 2]: +if a != [2, 1, 2]: print 'setitem() failed' a = range(4) test('setslice', a, None, 1, 3, [2, 1]) -if a <> [0, 2, 1, 3]: +if a != [0, 2, 1, 3]: print 'setslice() failed:', a test('sub', 5, 2, 3) diff --git a/Lib/test/test_pow.py b/Lib/test/test_pow.py index 0ef6cbf..f1e5179 100644 --- a/Lib/test/test_pow.py +++ b/Lib/test/test_pow.py @@ -110,11 +110,11 @@ for i in range(-10, 11): o = pow(i,j) % k n = pow(i,j,k) if o != n: print 'Integer mismatch:', i,j,k - if j >= 0 and k <> 0: + if j >= 0 and k != 0: o = pow(long(i),j) % k n = pow(long(i),j,k) if o != n: print 'Long mismatch:', i,j,k - if i >= 0 and k <> 0: + if i >= 0 and k != 0: o = pow(float(i),j) % k n = pow(float(i),j,k) if o != n: print 'Float mismatch:', i,j,k diff --git a/Lib/test/test_pty.py b/Lib/test/test_pty.py index 53769c0..5ea7e6f 100644 --- a/Lib/test/test_pty.py +++ b/Lib/test/test_pty.py @@ -81,7 +81,7 @@ else: raise TestFailed, "pty.fork() failed to make child a session leader." elif status / 256 == 3: raise TestFailed, "Child spawned by pty.fork() did not have a tty as stdout" - elif status / 256 <> 4: + elif status / 256 != 4: raise TestFailed, "pty.fork() failed for unknown reasons:" print os.read(master_fd, 65536) diff --git a/Lib/test/test_pwd.py b/Lib/test/test_pwd.py index 7e9db21..7425f53 100644 --- a/Lib/test/test_pwd.py +++ b/Lib/test/test_pwd.py @@ -12,11 +12,11 @@ for e in entries: print name, uid print 'pwd.getpwuid()' dbuid = pwd.getpwuid(uid) - if dbuid[0] <> name: + if dbuid[0] != name: print 'Mismatch in pwd.getpwuid()' print 'pwd.getpwnam()' dbname = pwd.getpwnam(name) - if dbname[2] <> uid: + if dbname[2] != uid: print 'Mismatch in pwd.getpwnam()' else: print 'name matches uid' diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py index 2dfa2bb..4d52c14 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -15,7 +15,7 @@ try: assert re.search('x*', 'axx').span() == (0, 0) assert re.search('x+', 'axx').span(0) == (1, 3) assert re.search('x+', 'axx').span() == (1, 3) - assert re.search('x', 'aaa') == None + assert re.search('x', 'aaa') is None except: raise TestFailed, "re.search" @@ -24,7 +24,7 @@ try: assert re.match('a*', 'xxx').span() == (0, 0) assert re.match('x*', 'xxxa').span(0) == (0, 3) assert re.match('x*', 'xxxa').span() == (0, 3) - assert re.match('a+', 'xxx') == None + assert re.match('a+', 'xxx') is None except: raise TestFailed, "re.search" @@ -216,11 +216,11 @@ try: p="" for i in range(0, 256): p = p + chr(i) - assert re.match(re.escape(chr(i)), chr(i)) != None + assert re.match(re.escape(chr(i)), chr(i)) is not None assert re.match(re.escape(chr(i)), chr(i)).span() == (0,1) pat=re.compile( re.escape(p) ) - assert pat.match(p) != None + assert pat.match(p) is not None assert pat.match(p).span() == (0,256) except AssertionError: raise TestFailed, "re.escape" @@ -335,14 +335,14 @@ for t in tests: # Try the match on a unicode string, and check that it # still succeeds. result = obj.search(unicode(s, "latin-1")) - if result == None: + if result is None: print '=== Fails on unicode match', t # Try the match on a unicode pattern, and check that it # still succeeds. obj=re.compile(unicode(pattern, "latin-1")) result = obj.search(s) - if result == None: + if result is None: print '=== Fails on unicode pattern match', t # Try the match with the search area limited to the extent @@ -351,29 +351,29 @@ for t in tests: # string), so we'll ignore patterns that feature it. if pattern[:2] != '\\B' and pattern[-2:] != '\\B' \ - and result != None: + and result is not None: obj = re.compile(pattern) result = obj.search(s, result.start(0), result.end(0) + 1) - if result == None: + if result is None: print '=== Failed on range-limited match', t # Try the match with IGNORECASE enabled, and check that it # still succeeds. obj = re.compile(pattern, re.IGNORECASE) result = obj.search(s) - if result == None: + if result is None: print '=== Fails on case-insensitive match', t # Try the match with LOCALE enabled, and check that it # still succeeds. obj = re.compile(pattern, re.LOCALE) result = obj.search(s) - if result == None: + if result is None: print '=== Fails on locale-sensitive match', t # Try the match with UNICODE locale enabled, and check # that it still succeeds. obj = re.compile(pattern, re.UNICODE) result = obj.search(s) - if result == None: + if result is None: print '=== Fails on unicode-sensitive match', t diff --git a/Lib/test/test_rotor.py b/Lib/test/test_rotor.py index a5c02aa..28c5af5 100644 --- a/Lib/test/test_rotor.py +++ b/Lib/test/test_rotor.py @@ -13,12 +13,12 @@ print `b` A1 = r.decrypt(a) print A1 -if A1 <> A: +if A1 != A: print 'decrypt failed' B1 = r.decryptmore(b) print B1 -if B1 <> B: +if B1 != B: print 'decryptmore failed' try: diff --git a/Lib/test/test_sax.py b/Lib/test/test_sax.py index b4c840b..e6f2755 100644 --- a/Lib/test/test_sax.py +++ b/Lib/test/test_sax.py @@ -395,8 +395,8 @@ def test_expat_locator_noinfo(): parser.feed("</doc>") parser.close() - return parser.getSystemId() == None and \ - parser.getPublicId() == None and \ + return parser.getSystemId() is None and \ + parser.getPublicId() is None and \ parser.getLineNumber() == 1 def test_expat_locator_withinfo(): @@ -407,7 +407,7 @@ def test_expat_locator_withinfo(): parser.parse(findfile("test.xml")) return parser.getSystemId() == findfile("test.xml") and \ - parser.getPublicId() == None + parser.getPublicId() is None # =========================================================================== @@ -484,7 +484,7 @@ def verify_empty_attrs(attrs): len(attrs) == 0 and \ not attrs.has_key("attr") and \ attrs.keys() == [] and \ - attrs.get("attrs") == None and \ + attrs.get("attrs") is None and \ attrs.get("attrs", 25) == 25 and \ attrs.items() == [] and \ attrs.values() == [] and \ @@ -552,7 +552,7 @@ def verify_empty_nsattrs(attrs): len(attrs) == 0 and \ not attrs.has_key((ns_uri, "attr")) and \ attrs.keys() == [] and \ - attrs.get((ns_uri, "attr")) == None and \ + attrs.get((ns_uri, "attr")) is None and \ attrs.get((ns_uri, "attr"), 25) == 25 and \ attrs.items() == [] and \ attrs.values() == [] and \ diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 92b9336..fe37936 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -137,7 +137,7 @@ try: msg = 'socket test' s.send(msg) data = s.recv(1024) - if msg <> data: + if msg != data: print 'parent/client mismatch' s.close() finally: diff --git a/Lib/test/test_sre.py b/Lib/test/test_sre.py index b9692a1..9c01c66 100644 --- a/Lib/test/test_sre.py +++ b/Lib/test/test_sre.py @@ -47,12 +47,12 @@ if verbose: print 'Running tests on character literals' for i in [0, 8, 16, 32, 64, 127, 128, 255]: - test(r"""sre.match(r"\%03o" % i, chr(i)) != None""", 1) - test(r"""sre.match(r"\%03o0" % i, chr(i)+"0") != None""", 1) - test(r"""sre.match(r"\%03o8" % i, chr(i)+"8") != None""", 1) - test(r"""sre.match(r"\x%02x" % i, chr(i)) != None""", 1) - test(r"""sre.match(r"\x%02x0" % i, chr(i)+"0") != None""", 1) - test(r"""sre.match(r"\x%02xz" % i, chr(i)+"z") != None""", 1) + test(r"""sre.match(r"\%03o" % i, chr(i)) is not None""", 1) + test(r"""sre.match(r"\%03o0" % i, chr(i)+"0") is not None""", 1) + test(r"""sre.match(r"\%03o8" % i, chr(i)+"8") is not None""", 1) + test(r"""sre.match(r"\x%02x" % i, chr(i)) is not None""", 1) + test(r"""sre.match(r"\x%02x0" % i, chr(i)+"0") is not None""", 1) + test(r"""sre.match(r"\x%02xz" % i, chr(i)+"z") is not None""", 1) test(r"""sre.match("\911", "")""", None, sre.error) # @@ -197,11 +197,11 @@ if verbose: p = "" for i in range(0, 256): p = p + chr(i) - test(r"""sre.match(sre.escape(chr(i)), chr(i)) != None""", 1) + test(r"""sre.match(sre.escape(chr(i)), chr(i)) is not None""", 1) test(r"""sre.match(sre.escape(chr(i)), chr(i)).span()""", (0,1)) pat = sre.compile(sre.escape(p)) -test(r"""pat.match(p) != None""", 1) +test(r"""pat.match(p) is not None""", 1) test(r"""pat.match(p).span()""", (0,256)) if verbose: diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py index 5892966..c48d92d 100644 --- a/Lib/test/test_struct.py +++ b/Lib/test/test_struct.py @@ -15,14 +15,14 @@ def simple_err(func, *args): simple_err(struct.calcsize, 'Q') sz = struct.calcsize('i') -if sz * 3 <> struct.calcsize('iii'): +if sz * 3 != struct.calcsize('iii'): raise TestFailed, 'inconsistent sizes' fmt = 'cbxxxxxxhhhhiillffd' fmt3 = '3c3b18x12h6i6l6f3d' sz = struct.calcsize(fmt) sz3 = struct.calcsize(fmt3) -if sz * 3 <> sz3: +if sz * 3 != sz3: raise TestFailed, 'inconsistent sizes (3*%s -> 3*%d = %d, %s -> %d)' % ( `fmt`, sz, 3*sz, `fmt3`, sz3) @@ -49,8 +49,8 @@ for prefix in ('', '@', '<', '>', '=', '!'): 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)): + 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))) diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py index 4f78b4c..a24b3ce 100644 --- a/Lib/test/test_support.py +++ b/Lib/test/test_support.py @@ -52,7 +52,7 @@ def fcmp(x, y): # fuzzy comparison function elif type(x) == type(y) and type(x) in (type(()), type([])): for i in range(min(len(x), len(y))): outcome = fcmp(x[i], y[i]) - if outcome <> 0: + if outcome != 0: return outcome return cmp(len(x), len(y)) return cmp(x, y) diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py index 03d081e..ebe8fa7 100644 --- a/Lib/test/test_time.py +++ b/Lib/test/test_time.py @@ -4,12 +4,12 @@ time.altzone time.clock() t = time.time() time.asctime(time.gmtime(t)) -if time.ctime(t) <> time.asctime(time.localtime(t)): - print 'time.ctime(t) <> time.asctime(time.localtime(t))' +if time.ctime(t) != time.asctime(time.localtime(t)): + print 'time.ctime(t) != time.asctime(time.localtime(t))' time.daylight -if long(time.mktime(time.localtime(t))) <> long(t): - print 'time.mktime(time.localtime(t)) <> t' +if long(time.mktime(time.localtime(t))) != long(t): + print 'time.mktime(time.localtime(t)) != t' time.sleep(1.2) tt = time.gmtime(t) diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py index cf4f6b4..bf35687 100644 --- a/Lib/test/test_types.py +++ b/Lib/test/test_types.py @@ -36,11 +36,11 @@ else: raise TestFailed, '1 and 1 is false instead of false' if not 1: raise TestFailed, 'not 1 is true instead of false' print '6.3 Comparisons' -if 0 < 1 <= 1 == 1 >= 1 > 0 <> 1: pass +if 0 < 1 <= 1 == 1 >= 1 > 0 != 1: pass else: raise TestFailed, 'int comparisons failed' -if 0L < 1L <= 1L == 1L >= 1L > 0L <> 1L: pass +if 0L < 1L <= 1L == 1L >= 1L > 0L != 1L: pass else: raise TestFailed, 'long int comparisons failed' -if 0.0 < 1.0 <= 1.0 == 1.0 >= 1.0 > 0.0 <> 1.0: pass +if 0.0 < 1.0 <= 1.0 == 1.0 >= 1.0 > 0.0 != 1.0: pass else: raise TestFailed, 'float comparisons failed' if '' < 'a' <= 'a' == 'a' < 'abc' < 'abd' < 'b': pass else: raise TestFailed, 'string comparisons failed' @@ -50,9 +50,9 @@ if None is None and [] is not []: pass else: raise TestFailed, 'identity test failed' print '6.4 Numeric types (mostly conversions)' -if 0 <> 0L or 0 <> 0.0 or 0L <> 0.0: raise TestFailed, 'mixed comparisons' -if 1 <> 1L or 1 <> 1.0 or 1L <> 1.0: raise TestFailed, 'mixed comparisons' -if -1 <> -1L or -1 <> -1.0 or -1L <> -1.0: +if 0 != 0L or 0 != 0.0 or 0L != 0.0: raise TestFailed, 'mixed comparisons' +if 1 != 1L or 1 != 1.0 or 1L != 1.0: raise TestFailed, 'mixed comparisons' +if -1 != -1L or -1 != -1.0 or -1L != -1.0: raise TestFailed, 'int/long/float value not equal' if int(1.9) == 1 == int(1.1) and int(-1.1) == -1 == int(-1.9): pass else: raise TestFailed, 'int() does not round properly' @@ -61,10 +61,10 @@ else: raise TestFailed, 'long() does not round properly' if float(1) == 1.0 and float(-1) == -1.0 and float(0) == 0.0: pass else: raise TestFailed, 'float() does not work properly' print '6.4.1 32-bit integers' -if 12 + 24 <> 36: raise TestFailed, 'int op' -if 12 + (-24) <> -12: raise TestFailed, 'int op' -if (-12) + 24 <> 12: raise TestFailed, 'int op' -if (-12) + (-24) <> -36: raise TestFailed, 'int op' +if 12 + 24 != 36: raise TestFailed, 'int op' +if 12 + (-24) != -12: raise TestFailed, 'int op' +if (-12) + 24 != 12: raise TestFailed, 'int op' +if (-12) + (-24) != -36: raise TestFailed, 'int op' if not 12 < 24: raise TestFailed, 'int op' if not -24 < -12: raise TestFailed, 'int op' # Test for a particular bug in integer multiply @@ -72,10 +72,10 @@ xsize, ysize, zsize = 238, 356, 4 if not (xsize*ysize*zsize == zsize*xsize*ysize == 338912): raise TestFailed, 'int mul commutativity' print '6.4.2 Long integers' -if 12L + 24L <> 36L: raise TestFailed, 'long op' -if 12L + (-24L) <> -12L: raise TestFailed, 'long op' -if (-12L) + 24L <> 12L: raise TestFailed, 'long op' -if (-12L) + (-24L) <> -36L: raise TestFailed, 'long op' +if 12L + 24L != 36L: raise TestFailed, 'long op' +if 12L + (-24L) != -12L: raise TestFailed, 'long op' +if (-12L) + 24L != 12L: raise TestFailed, 'long op' +if (-12L) + (-24L) != -36L: raise TestFailed, 'long op' if not 12L < 24L: raise TestFailed, 'long op' if not -24L < -12L: raise TestFailed, 'long op' x = sys.maxint @@ -91,49 +91,49 @@ try: int(long(x)-1L) except OverflowError: pass else:raise TestFailed, 'long op' print '6.4.3 Floating point numbers' -if 12.0 + 24.0 <> 36.0: raise TestFailed, 'float op' -if 12.0 + (-24.0) <> -12.0: raise TestFailed, 'float op' -if (-12.0) + 24.0 <> 12.0: raise TestFailed, 'float op' -if (-12.0) + (-24.0) <> -36.0: raise TestFailed, 'float op' +if 12.0 + 24.0 != 36.0: raise TestFailed, 'float op' +if 12.0 + (-24.0) != -12.0: raise TestFailed, 'float op' +if (-12.0) + 24.0 != 12.0: raise TestFailed, 'float op' +if (-12.0) + (-24.0) != -36.0: raise TestFailed, 'float op' if not 12.0 < 24.0: raise TestFailed, 'float op' if not -24.0 < -12.0: raise TestFailed, 'float op' print '6.5 Sequence types' print '6.5.1 Strings' -if len('') <> 0: raise TestFailed, 'len(\'\')' -if len('a') <> 1: raise TestFailed, 'len(\'a\')' -if len('abcdef') <> 6: raise TestFailed, 'len(\'abcdef\')' -if 'xyz' + 'abcde' <> 'xyzabcde': raise TestFailed, 'string concatenation' -if 'xyz'*3 <> 'xyzxyzxyz': raise TestFailed, 'string repetition *3' -if 0*'abcde' <> '': raise TestFailed, 'string repetition 0*' -if min('abc') <> 'a' or max('abc') <> 'c': raise TestFailed, 'min/max string' +if len('') != 0: raise TestFailed, 'len(\'\')' +if len('a') != 1: raise TestFailed, 'len(\'a\')' +if len('abcdef') != 6: raise TestFailed, 'len(\'abcdef\')' +if 'xyz' + 'abcde' != 'xyzabcde': raise TestFailed, 'string concatenation' +if 'xyz'*3 != 'xyzxyzxyz': raise TestFailed, 'string repetition *3' +if 0*'abcde' != '': raise TestFailed, 'string repetition 0*' +if min('abc') != 'a' or max('abc') != 'c': raise TestFailed, 'min/max string' if 'a' in 'abc' and 'b' in 'abc' and 'c' in 'abc' and 'd' not in 'abc': pass else: raise TestFailed, 'in/not in string' x = 'x'*103 if '%s!'%x != x+'!': raise TestFailed, 'nasty string formatting bug' print '6.5.2 Tuples' -if len(()) <> 0: raise TestFailed, 'len(())' -if len((1,)) <> 1: raise TestFailed, 'len((1,))' -if len((1,2,3,4,5,6)) <> 6: raise TestFailed, 'len((1,2,3,4,5,6))' -if (1,2)+(3,4) <> (1,2,3,4): raise TestFailed, 'tuple concatenation' -if (1,2)*3 <> (1,2,1,2,1,2): raise TestFailed, 'tuple repetition *3' -if 0*(1,2,3) <> (): raise TestFailed, 'tuple repetition 0*' -if min((1,2)) <> 1 or max((1,2)) <> 2: raise TestFailed, 'min/max tuple' +if len(()) != 0: raise TestFailed, 'len(())' +if len((1,)) != 1: raise TestFailed, 'len((1,))' +if len((1,2,3,4,5,6)) != 6: raise TestFailed, 'len((1,2,3,4,5,6))' +if (1,2)+(3,4) != (1,2,3,4): raise TestFailed, 'tuple concatenation' +if (1,2)*3 != (1,2,1,2,1,2): raise TestFailed, 'tuple repetition *3' +if 0*(1,2,3) != (): raise TestFailed, 'tuple repetition 0*' +if min((1,2)) != 1 or max((1,2)) != 2: raise TestFailed, 'min/max tuple' if 0 in (0,1,2) and 1 in (0,1,2) and 2 in (0,1,2) and 3 not in (0,1,2): pass else: raise TestFailed, 'in/not in tuple' print '6.5.3 Lists' -if len([]) <> 0: raise TestFailed, 'len([])' -if len([1,]) <> 1: raise TestFailed, 'len([1,])' -if len([1,2,3,4,5,6]) <> 6: raise TestFailed, 'len([1,2,3,4,5,6])' -if [1,2]+[3,4] <> [1,2,3,4]: raise TestFailed, 'list concatenation' -if [1,2]*3 <> [1,2,1,2,1,2]: raise TestFailed, 'list repetition *3' -if [1,2]*3L <> [1,2,1,2,1,2]: raise TestFailed, 'list repetition *3L' -if 0*[1,2,3] <> []: raise TestFailed, 'list repetition 0*' -if 0L*[1,2,3] <> []: raise TestFailed, 'list repetition 0L*' -if min([1,2]) <> 1 or max([1,2]) <> 2: raise TestFailed, 'min/max list' +if len([]) != 0: raise TestFailed, 'len([])' +if len([1,]) != 1: raise TestFailed, 'len([1,])' +if len([1,2,3,4,5,6]) != 6: raise TestFailed, 'len([1,2,3,4,5,6])' +if [1,2]+[3,4] != [1,2,3,4]: raise TestFailed, 'list concatenation' +if [1,2]*3 != [1,2,1,2,1,2]: raise TestFailed, 'list repetition *3' +if [1,2]*3L != [1,2,1,2,1,2]: raise TestFailed, 'list repetition *3L' +if 0*[1,2,3] != []: raise TestFailed, 'list repetition 0*' +if 0L*[1,2,3] != []: raise TestFailed, 'list repetition 0L*' +if min([1,2]) != 1 or max([1,2]) != 2: raise TestFailed, 'min/max list' if 0 in [0,1,2] and 1 in [0,1,2] and 2 in [0,1,2] and 3 not in [0,1,2]: pass else: raise TestFailed, 'in/not in list' a = [1, 2, 3, 4, 5] @@ -155,55 +155,55 @@ a = [0,1,2,3,4] a[0L] = 1 a[1L] = 2 a[2L] = 3 -if a <> [1,2,3,3,4]: raise TestFailed, 'list item assignment [0L], [1L], [2L]' +if a != [1,2,3,3,4]: raise TestFailed, 'list item assignment [0L], [1L], [2L]' a[0] = 5 a[1] = 6 a[2] = 7 -if a <> [5,6,7,3,4]: raise TestFailed, 'list item assignment [0], [1], [2]' +if a != [5,6,7,3,4]: raise TestFailed, 'list item assignment [0], [1], [2]' a[-2L] = 88 a[-1L] = 99 -if a <> [5,6,7,88,99]: raise TestFailed, 'list item assignment [-2L], [-1L]' +if a != [5,6,7,88,99]: raise TestFailed, 'list item assignment [-2L], [-1L]' a[-2] = 8 a[-1] = 9 -if a <> [5,6,7,8,9]: raise TestFailed, 'list item assignment [-2], [-1]' +if a != [5,6,7,8,9]: raise TestFailed, 'list item assignment [-2], [-1]' a[:2] = [0,4] a[-3:] = [] a[1:1] = [1,2,3] -if a <> [0,1,2,3,4]: raise TestFailed, 'list slice assignment' +if a != [0,1,2,3,4]: raise TestFailed, 'list slice assignment' a[ 1L : 4L] = [7,8,9] -if a <> [0,7,8,9,4]: raise TestFailed, 'list slice assignment using long ints' +if a != [0,7,8,9,4]: raise TestFailed, 'list slice assignment using long ints' del a[1:4] -if a <> [0,4]: raise TestFailed, 'list slice deletion' +if a != [0,4]: raise TestFailed, 'list slice deletion' del a[0] -if a <> [4]: raise TestFailed, 'list item deletion [0]' +if a != [4]: raise TestFailed, 'list item deletion [0]' del a[-1] -if a <> []: raise TestFailed, 'list item deletion [-1]' +if a != []: raise TestFailed, 'list item deletion [-1]' a=range(0,5) del a[1L:4L] -if a <> [0,4]: raise TestFailed, 'list slice deletion' +if a != [0,4]: raise TestFailed, 'list slice deletion' del a[0L] -if a <> [4]: raise TestFailed, 'list item deletion [0]' +if a != [4]: raise TestFailed, 'list item deletion [0]' del a[-1L] -if a <> []: raise TestFailed, 'list item deletion [-1]' +if a != []: raise TestFailed, 'list item deletion [-1]' a.append(0) a.append(1) a.append(2) -if a <> [0,1,2]: raise TestFailed, 'list append' +if a != [0,1,2]: raise TestFailed, 'list append' a.insert(0, -2) a.insert(1, -1) a.insert(2,0) -if a <> [-2,-1,0,0,1,2]: raise TestFailed, 'list insert' -if a.count(0) <> 2: raise TestFailed, ' list count' -if a.index(0) <> 2: raise TestFailed, 'list index' +if a != [-2,-1,0,0,1,2]: raise TestFailed, 'list insert' +if a.count(0) != 2: raise TestFailed, ' list count' +if a.index(0) != 2: raise TestFailed, 'list index' a.remove(0) -if a <> [-2,-1,0,1,2]: raise TestFailed, 'list remove' +if a != [-2,-1,0,1,2]: raise TestFailed, 'list remove' a.reverse() -if a <> [2,1,0,-1,-2]: raise TestFailed, 'list reverse' +if a != [2,1,0,-1,-2]: raise TestFailed, 'list reverse' a.sort() -if a <> [-2,-1,0,1,2]: raise TestFailed, 'list sort' +if a != [-2,-1,0,1,2]: raise TestFailed, 'list sort' def revcmp(a, b): return cmp(b, a) a.sort(revcmp) -if a <> [2,1,0,-1,-2]: raise TestFailed, 'list sort with cmp func' +if a != [2,1,0,-1,-2]: raise TestFailed, 'list sort with cmp func' # The following dumps core in unpatched Python 1.5: def myComparison(x,y): return cmp(x%3, y%7) @@ -219,22 +219,22 @@ if a[ 3: pow(2,145L) ] != [3,4]: print '6.6 Mappings == Dictionaries' d = {} -if d.keys() <> []: raise TestFailed, '{}.keys()' -if d.has_key('a') <> 0: raise TestFailed, '{}.has_key(\'a\')' -if len(d) <> 0: raise TestFailed, 'len({})' +if d.keys() != []: raise TestFailed, '{}.keys()' +if d.has_key('a') != 0: raise TestFailed, '{}.has_key(\'a\')' +if len(d) != 0: raise TestFailed, 'len({})' d = {'a': 1, 'b': 2} -if len(d) <> 2: raise TestFailed, 'len(dict)' +if len(d) != 2: raise TestFailed, 'len(dict)' k = d.keys() k.sort() -if k <> ['a', 'b']: raise TestFailed, 'dict keys()' +if k != ['a', 'b']: raise TestFailed, 'dict keys()' if d.has_key('a') and d.has_key('b') and not d.has_key('c'): pass else: raise TestFailed, 'dict keys()' -if d['a'] <> 1 or d['b'] <> 2: raise TestFailed, 'dict item' +if d['a'] != 1 or d['b'] != 2: raise TestFailed, 'dict item' d['c'] = 3 d['a'] = 4 -if d['c'] <> 3 or d['a'] <> 4: raise TestFailed, 'dict item assignment' +if d['c'] != 3 or d['a'] != 4: raise TestFailed, 'dict item assignment' del d['b'] -if d <> {'a': 4, 'c': 3}: raise TestFailed, 'dict item deletion' +if d != {'a': 4, 'c': 3}: raise TestFailed, 'dict item deletion' d = {1:1, 2:2, 3:3} d.clear() if d != {}: raise TestFailed, 'dict clear' @@ -246,24 +246,24 @@ if d.copy() != {1:1, 2:2, 3:3}: raise TestFailed, 'dict copy' if {}.copy() != {}: raise TestFailed, 'empty dict copy' # dict.get() d = {} -if d.get('c') != None: raise TestFailed, 'missing {} get, no 2nd arg' +if d.get('c') is not None: raise TestFailed, 'missing {} get, no 2nd arg' if d.get('c', 3) != 3: raise TestFailed, 'missing {} get, w/ 2nd arg' d = {'a' : 1, 'b' : 2} -if d.get('c') != None: raise TestFailed, 'missing dict get, no 2nd arg' +if d.get('c') is not None: raise TestFailed, 'missing dict get, no 2nd arg' if d.get('c', 3) != 3: raise TestFailed, 'missing dict get, w/ 2nd arg' if d.get('a') != 1: raise TestFailed, 'present dict get, no 2nd arg' if d.get('a', 3) != 1: raise TestFailed, 'present dict get, w/ 2nd arg' # dict.setdefault() d = {} -if d.setdefault('key0') <> None: +if d.setdefault('key0') is not None: raise TestFailed, 'missing {} setdefault, no 2nd arg' -if d.setdefault('key0') <> None: +if d.setdefault('key0') is not None: raise TestFailed, 'present {} setdefault, no 2nd arg' d.setdefault('key', []).append(3) -if d['key'][0] <> 3: +if d['key'][0] != 3: raise TestFailed, 'missing {} setdefault, w/ 2nd arg' d.setdefault('key', []).append(4) -if len(d['key']) <> 2: +if len(d['key']) != 2: raise TestFailed, 'present {} setdefault, w/ 2nd arg' # dict.popitem() for copymode in -1, +1: diff --git a/Lib/test/test_unpack.py b/Lib/test/test_unpack.py index 25b94e9..b913b9e 100644 --- a/Lib/test/test_unpack.py +++ b/Lib/test/test_unpack.py @@ -16,35 +16,35 @@ c = -1 if verbose: print 'unpack tuple' a, b, c = t -if a <> 1 or b <> 2 or c <> 3: +if a != 1 or b != 2 or c != 3: raise TestFailed # unpack list if verbose: print 'unpack list' a, b, c = l -if a <> 4 or b <> 5 or c <> 6: +if a != 4 or b != 5 or c != 6: raise TestFailed # unpack implied tuple if verbose: print 'unpack implied tuple' a, b, c = 7, 8, 9 -if a <> 7 or b <> 8 or c <> 9: +if a != 7 or b != 8 or c != 9: raise TestFailed # unpack string... fun! if verbose: print 'unpack string' a, b, c = 'one' -if a <> 'o' or b <> 'n' or c <> 'e': +if a != 'o' or b != 'n' or c != 'e': raise TestFailed # unpack generic sequence if verbose: print 'unpack sequence' a, b, c = Seq() -if a <> 0 or b <> 1 or c <> 2: +if a != 0 or b != 1 or c != 2: raise TestFailed # single element unpacking, with extra syntax @@ -53,10 +53,10 @@ if verbose: st = (99,) sl = [100] a, = st -if a <> 99: +if a != 99: raise TestFailed b, = sl -if b <> 100: +if b != 100: raise TestFailed # now for some failures |