Skip to content

Commit fd894ec

Browse files
committed
Lint fixes
1 parent 07971e1 commit fd894ec

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

Lib/test/test_profile.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ def test_output_file_when_changing_directory(self):
131131

132132
self.assertTrue(os.path.exists('out.pstats'))
133133

134+
134135
class ProfileCLITests(unittest.TestCase):
135136
"""Tests for the profile module's command line interface."""
136137

@@ -173,9 +174,9 @@ def test_sort_options(self):
173174
"""Test different sort options."""
174175
# List of sort options known to work
175176
sort_options = ['calls', 'cumulative', 'cumtime', 'file',
176-
'filename', 'module', 'ncalls', 'pcalls',
177-
'line', 'stdname', 'time', 'tottime']
178-
177+
'filename', 'module', 'ncalls', 'pcalls',
178+
'line', 'stdname', 'time', 'tottime']
179+
179180
# Test each sort option individually
180181
for option in sort_options:
181182
with self.subTest(sort_option=option):
@@ -189,12 +190,12 @@ def test_output_file(self):
189190
"""Test writing profile results to a file."""
190191
output_file = TESTFN + '.prof'
191192
self.addCleanup(unlink, output_file)
192-
193+
193194
returncode, stdout, stderr = self._run_profile_cli(
194195
'-o', output_file, self.script_file
195196
)
196197
self.assertEqual(returncode, 0)
197-
198+
198199
# Check that the output file exists and contains profile data
199200
self.assertTrue(os.path.exists(output_file))
200201
stats = pstats.Stats(output_file)
@@ -212,32 +213,35 @@ def test_no_arguments(self):
212213
"""Test behavior with no arguments."""
213214
returncode, stdout, stderr = self._run_profile_cli()
214215
self.assertNotEqual(returncode, 0)
215-
216+
216217
# Check either stdout or stderr for usage information
217218
combined_output = stdout.lower() + stderr.lower()
218-
self.assertTrue("usage:" in combined_output or
219-
"error:" in combined_output or
220-
"no script filename specified" in combined_output,
221-
"Expected usage information or error message not found")
219+
self.assertTrue(
220+
"usage:" in combined_output or
221+
"error:" in combined_output or
222+
"no script filename specified" in combined_output,
223+
"Expected usage information or error message not found"
224+
)
222225

223226
def test_run_module(self):
224227
"""Test profiling a module with -m option."""
225228
# Create a small module
226229
module_name = "test_profile_module"
227230
module_file = f"{module_name}.py"
228-
231+
229232
with open(module_file, "w") as f:
230233
f.write("print('Module executed')\n")
231-
234+
232235
self.addCleanup(unlink, module_file)
233-
236+
234237
returncode, stdout, stderr = self._run_profile_cli(
235238
'-m', module_name
236239
)
237240
self.assertEqual(returncode, 0)
238241
self.assertIn("Module executed", stdout)
239242
self.assertIn("function calls", stdout)
240243

244+
241245
def regenerate_expected_output(filename, cls):
242246
filename = filename.rstrip('co')
243247
print('Regenerating %s...' % filename)

0 commit comments

Comments
 (0)