summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_struct.py
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2000-12-12 23:11:42 (GMT)
committerFred Drake <fdrake@acm.org>2000-12-12 23:11:42 (GMT)
commit132dce22469f476f399d1bbc6d1cc2f7ba0110cc (patch)
tree4b0988e41b3b7d25d10c2a24fb18b07ff376f66d /Lib/test/test_struct.py
parent63596aeb33c2837d7802449c8906349c9ea1998e (diff)
downloadcpython-132dce22469f476f399d1bbc6d1cc2f7ba0110cc.zip
cpython-132dce22469f476f399d1bbc6d1cc2f7ba0110cc.tar.gz
cpython-132dce22469f476f399d1bbc6d1cc2f7ba0110cc.tar.bz2
Update the code to better reflect recommended style:
Use != instead of <> since <> is documented as "obsolescent". Use "is" and "is not" when comparing with None or type objects.
Diffstat (limited to 'Lib/test/test_struct.py')
-rw-r--r--Lib/test/test_struct.py8
1 files changed, 4 insertions, 4 deletions
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)))