Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tornado/concurrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def wrapper(self: Any, *args: Any, **kwargs: Any) -> Future:
if len(args) == 1:
return run_on_executor_decorator(args[0])
elif len(args) != 0:
raise ValueError("expected 1 argument, got %d", len(args))
raise ValueError("expected 1 argument, got %d" % len(args))
return run_on_executor_decorator


Expand Down
10 changes: 10 additions & 0 deletions tornado/test/concurrent_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,5 +227,15 @@ async def f():
self.assertEqual(result, 42)


class RunOnExecutorArgValidationTest(AsyncTestCase):
def test_run_on_executor_bad_args(self):
with self.assertRaisesRegex(ValueError, "expected 1 argument, got 2"):
@run_on_executor(1, 2)
def f():
pass

pass


if __name__ == "__main__":
unittest.main()