Skip to content

Commit

Permalink
Handle different error messages since 3.13.alpha.4
Browse files Browse the repository at this point in the history
  • Loading branch information
SylvainDe committed Apr 10, 2024
1 parent 437f107 commit adecce7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions didyoumean/didyoumean_sugg_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1663,16 +1663,21 @@ def test_keyword_builtin(self):
# NICE_TO_HAVE
# 'max', 'input', 'len', 'abs', 'all', etc have a specific error
# message and are not relevant here
before, after = before_and_after((3, 7))
before, mid, after = before_mid_and_after(
(3, 7),
(3, 13, 0, 'alpha', 4)
)
for builtin, kwarg in [
('float', False), ('bool', False),
('int', True), ('complex', True)]:
code = builtin + '(this_doesnt_exist=2)'
old_exc = UNEXPECTEDKWARG2
new_exc = UNEXPECTEDKWARG4 if kwarg else NOKWARGS
new_exc2 = UNEXPECTEDKWARG if kwarg else NOKWARGS
sugg = [] if kwarg else NO_KEYWORD_ARG_MSG
self.throws(code, old_exc, [], before, interpreters='cpython')
self.throws(code, new_exc, sugg, after, interpreters='cpython')
self.throws(code, new_exc, sugg, mid, interpreters='cpython')
self.throws(code, new_exc2, sugg, after, interpreters='cpython')
self.throws(code, UNEXPECTEDKWARG, interpreters='pypy')

def test_keyword_builtin_print(self):
Expand Down

0 comments on commit adecce7

Please sign in to comment.