Skip to content

Commit 02ea12b

Browse files
committed
Syntax cleanup.
1 parent 3f8ab96 commit 02ea12b

File tree

7 files changed

+9
-11
lines changed

7 files changed

+9
-11
lines changed

Lib/ctypes/test/test_callbacks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def func(x):
164164
result = integrate(0.0, 1.0, CALLBACK(func), 10)
165165
diff = abs(result - 1./3.)
166166

167-
self.assertTrue(diff < 0.01, "%s not less than 0.01" % diff)
167+
self.assertLess(diff, 0.01, "%s not less than 0.01" % diff)
168168

169169
def test_issue_8959_a(self):
170170
from ctypes.util import find_library

Lib/json/encoder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ def _iterencode(o, _current_indent_level):
397397
yield 'true'
398398
elif o is False:
399399
yield 'false'
400-
elif isinstance(o, (int, int)):
400+
elif isinstance(o, int):
401401
yield str(o)
402402
elif isinstance(o, float):
403403
yield _floatstr(o)

Lib/pickletools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ def __repr__(self):
733733

734734
pyinteger_or_bool = StackObject(
735735
name='int_or_bool',
736-
obtype=(int, int, bool),
736+
obtype=(int, bool),
737737
doc="A Python integer object (short or long), or "
738738
"a Python bool.")
739739

Lib/test/script_helper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def make_zip_script(zip_dir, zip_basename, script_name, name_in_zip=None):
7979
name_in_zip = os.path.basename(script_name)
8080
zip_file.write(script_name, name_in_zip)
8181
zip_file.close()
82-
#if test.test_support.verbose:
82+
#if test.support.verbose:
8383
# zip_file = zipfile.ZipFile(zip_name, 'r')
8484
# print 'Contents of %r:' % zip_name
8585
# zip_file.printdir()
@@ -114,7 +114,7 @@ def make_zip_pkg(zip_dir, zip_basename, pkg_name, script_basename,
114114
zip_file.close()
115115
for name in unlink:
116116
os.unlink(name)
117-
#if test.test_support.verbose:
117+
#if test.support.verbose:
118118
# zip_file = zipfile.ZipFile(zip_name, 'r')
119119
# print 'Contents of %r:' % zip_name
120120
# zip_file.printdir()

Lib/test/test_binop.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def isint(x):
1616

1717
def isnum(x):
1818
"""Test whether an object is an instance of a built-in numeric type."""
19-
for T in int, int, float, complex:
19+
for T in int, float, complex:
2020
if isinstance(x, T):
2121
return 1
2222
return 0

Lib/test/test_pow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ def powtest(self, type):
1818
self.assertEquals(pow(2, i), pow2)
1919
if i != 30 : pow2 = pow2*2
2020

21-
for othertype in int, int:
21+
for othertype in (int,):
2222
for i in list(range(-10, 0)) + list(range(1, 10)):
2323
ii = type(i)
2424
for j in range(1, 11):
2525
jj = -othertype(j)
2626
pow(ii, jj)
2727

28-
for othertype in int, int, float:
28+
for othertype in int, float:
2929
for i in range(1, 100):
3030
zero = type(0)
3131
exp = -othertype(i/10.0)

Lib/test/test_sys.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ def test_excepthook(self):
8686
# Python/pythonrun.c::PyErr_PrintEx() is tricky.
8787

8888
def test_exit(self):
89-
import subprocess
9089

9190
self.assertRaises(TypeError, sys.exit, 42, 42)
9291

@@ -529,7 +528,6 @@ def test_clear_type_cache(self):
529528
sys._clear_type_cache()
530529

531530
def test_ioencoding(self):
532-
import subprocess
533531
env = dict(os.environ)
534532

535533
# Test character: cent sign, encoded as 0x4A (ASCII J) in CP424,
@@ -551,7 +549,7 @@ def test_executable(self):
551549
# Issue #7774: Ensure that sys.executable is an empty string if argv[0]
552550
# has been set to an non existent program name and Python is unable to
553551
# retrieve the real program name
554-
import subprocess
552+
555553
# For a normal installation, it should work without 'cwd'
556554
# argument. For test runs in the build directory, see #7774.
557555
python_dir = os.path.dirname(os.path.realpath(sys.executable))

0 commit comments

Comments
 (0)