Skip to content

Commit 9274aac

Browse files
committed
refactoring
1 parent 745faa8 commit 9274aac

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

test/test_autopep8.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5506,8 +5506,8 @@ def test_exit_code_with_io_error(self):
55065506
print(filename)
55075507
p = Popen(list(AUTOPEP8_CMD_TUPLE) + ['--in-place', filename],
55085508
stdout=PIPE, stderr=PIPE)
5509-
result = p.communicate()
5510-
self.assertEqual(p.returncode, 1)
5509+
p.communicate()
5510+
self.assertEqual(p.returncode, autopep8.EXIT_CODE_ERROR)
55115511

55125512
def test_pep8_passes(self):
55135513
line = "'abc' \n"
@@ -5654,7 +5654,6 @@ def test_parallel_jobs(self):
56545654

56555655
def test_parallel_jobs_with_diff_option(self):
56565656
line = "'abc' \n"
5657-
fixed = "'abc'\n"
56585657

56595658
with temporary_file_context(line) as filename_a:
56605659
with temporary_file_context(line) as filename_b:
@@ -5673,7 +5672,7 @@ def test_parallel_jobs_with_diff_option(self):
56735672
-'abc'
56745673
+'abc'
56755674
""".format(filename=filename))
5676-
self.assertEqual(0, p.returncode)
5675+
self.assertEqual(p.returncode, autopep8.EXIT_CODE_OK)
56775676
for actual_diff in actual_diffs:
56785677
self.assertIn(actual_diff, output)
56795678

@@ -5694,8 +5693,8 @@ def test_parallel_jobs_with_inplace_option_and_io_error(self):
56945693
p = Popen(list(AUTOPEP8_CMD_TUPLE) +
56955694
[temp_directory, '--recursive', '--in-place'],
56965695
stdout=PIPE, stderr=PIPE)
5697-
result = p.communicate()[0].decode('utf-8')
5698-
self.assertEqual(p.returncode, 1)
5696+
p.communicate()[0].decode('utf-8')
5697+
self.assertEqual(p.returncode, autopep8.EXIT_CODE_ERROR)
56995698
finally:
57005699
shutil.rmtree(temp_directory)
57015700

@@ -6048,7 +6047,7 @@ def test_pyproject_toml_with_flake8_config(self):
60486047
fp.write(line)
60496048
p = Popen(list(AUTOPEP8_CMD_TUPLE) + [target_filename], stdout=PIPE)
60506049
self.assertEqual(p.communicate()[0].decode("utf-8"), line)
6051-
self.assertEqual(p.returncode, 0)
6050+
self.assertEqual(p.returncode, autopep8.EXIT_CODE_OK)
60526051

60536052
def test_pyproject_toml_with_verbose_option(self):
60546053
"""override to flake8 config"""
@@ -6065,7 +6064,7 @@ def test_pyproject_toml_with_verbose_option(self):
60656064
output = p.communicate()[0].decode("utf-8")
60666065
self.assertTrue(line in output)
60676066
self.assertTrue(verbose_line in output)
6068-
self.assertEqual(p.returncode, 0)
6067+
self.assertEqual(p.returncode, autopep8.EXIT_CODE_OK)
60696068

60706069
def test_pyproject_toml_with_iterable_value(self):
60716070
line = "a = 1\n"
@@ -6079,7 +6078,7 @@ def test_pyproject_toml_with_iterable_value(self):
60796078
p = Popen(list(AUTOPEP8_CMD_TUPLE) + [target_filename, ], stdout=PIPE)
60806079
output = p.communicate()[0].decode("utf-8")
60816080
self.assertTrue(line in output)
6082-
self.assertEqual(p.returncode, 0)
6081+
self.assertEqual(p.returncode, autopep8.EXIT_CODE_OK)
60836082

60846083

60856084
class ExperimentalSystemTests(unittest.TestCase):

0 commit comments

Comments
 (0)