Skip to content

Commit fd2603e

Browse files
committed
Replace typing.Never with typing.NoReturn since Never wasn't introduced until Python 3.11
1 parent 881a985 commit fd2603e

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

tests/test_cmd2.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from code import (
1212
InteractiveConsole,
1313
)
14-
from typing import Never
14+
from typing import NoReturn
1515
from unittest import (
1616
mock,
1717
)
@@ -512,7 +512,7 @@ def test_runcmds_plus_hooks_ctrl_c(base_app, capsys) -> None:
512512
"""Test Ctrl-C while in runcmds_plus_hooks"""
513513
import types
514514

515-
def do_keyboard_interrupt(self, _) -> Never:
515+
def do_keyboard_interrupt(self, _) -> NoReturn:
516516
raise KeyboardInterrupt('Interrupting this command')
517517

518518
setattr(base_app, 'do_keyboard_interrupt', types.MethodType(do_keyboard_interrupt, base_app))
@@ -603,7 +603,7 @@ def test_system_exit_in_command(base_app, capsys) -> None:
603603

604604
exit_code = 5
605605

606-
def do_system_exit(self, _) -> Never:
606+
def do_system_exit(self, _) -> NoReturn:
607607
raise SystemExit(exit_code)
608608

609609
setattr(base_app, 'do_system_exit', types.MethodType(do_system_exit, base_app))
@@ -619,7 +619,7 @@ def test_passthrough_exception_in_command(base_app) -> None:
619619

620620
expected_err = "Pass me up"
621621

622-
def do_passthrough(self, _) -> Never:
622+
def do_passthrough(self, _) -> NoReturn:
623623
wrapped_ex = OSError(expected_err)
624624
raise exceptions.PassThroughException(wrapped_ex=wrapped_ex)
625625

tests/test_completion.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import enum
99
import os
1010
import sys
11-
from typing import Never
11+
from typing import NoReturn
1212
from unittest import (
1313
mock,
1414
)
@@ -97,7 +97,7 @@ def complete_test_sort_key(self, text, line, begidx, endidx):
9797
def do_test_raise_exception(self, args) -> None:
9898
pass
9999

100-
def complete_test_raise_exception(self, text, line, begidx, endidx) -> Never:
100+
def complete_test_raise_exception(self, text, line, begidx, endidx) -> NoReturn:
101101
raise IndexError("You are out of bounds!!")
102102

103103
def do_test_multiline(self, args) -> None:

tests/test_plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import argparse
66
import sys
7-
from typing import Never
7+
from typing import NoReturn
88
from unittest import (
99
mock,
1010
)
@@ -273,7 +273,7 @@ def do_say(self, statement) -> None:
273273
"""Repeat back the arguments"""
274274
self.poutput(statement)
275275

276-
def do_skip_postcmd_hooks(self, _) -> Never:
276+
def do_skip_postcmd_hooks(self, _) -> NoReturn:
277277
self.poutput("In do_skip_postcmd_hooks")
278278
raise exceptions.SkipPostcommandHooks
279279

tests/test_transcript.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import re
88
import sys
99
import tempfile
10-
from typing import Never
10+
from typing import NoReturn
1111
from unittest import (
1212
mock,
1313
)
@@ -90,7 +90,7 @@ def do_mumble(self, opts, arg) -> None:
9090
def do_nothing(self, statement) -> None:
9191
"""Do nothing and output nothing"""
9292

93-
def do_keyboard_interrupt(self, _) -> Never:
93+
def do_keyboard_interrupt(self, _) -> NoReturn:
9494
raise KeyboardInterrupt('Interrupting this command')
9595

9696

0 commit comments

Comments
 (0)