mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
gh-119057: Use better error messages for zero division (#119066)
This commit is contained in:
parent
153b118b78
commit
1d4c2e4a87
11 changed files with 32 additions and 20 deletions
|
@ -1035,7 +1035,7 @@ replaced with any other string:
|
|||
... >>> x = 12
|
||||
... >>> print(x//0)
|
||||
... Traceback (most recent call last):
|
||||
... ZeroDivisionError: integer division or modulo by zero
|
||||
... ZeroDivisionError: division by zero
|
||||
... '''
|
||||
>>> test = doctest.DocTestFinder().find(f)[0]
|
||||
>>> doctest.DocTestRunner(verbose=False).run(test)
|
||||
|
@ -1052,7 +1052,7 @@ unexpected exception:
|
|||
... >>> print('pre-exception output', x//0)
|
||||
... pre-exception output
|
||||
... Traceback (most recent call last):
|
||||
... ZeroDivisionError: integer division or modulo by zero
|
||||
... ZeroDivisionError: division by zero
|
||||
... '''
|
||||
>>> test = doctest.DocTestFinder().find(f)[0]
|
||||
>>> doctest.DocTestRunner(verbose=False).run(test)
|
||||
|
@ -1063,7 +1063,7 @@ unexpected exception:
|
|||
print('pre-exception output', x//0)
|
||||
Exception raised:
|
||||
...
|
||||
ZeroDivisionError: integer division or modulo by zero
|
||||
ZeroDivisionError: division by zero
|
||||
TestResults(failed=1, attempted=2)
|
||||
|
||||
Exception messages may contain newlines:
|
||||
|
@ -1258,7 +1258,7 @@ unexpected exception:
|
|||
Exception raised:
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
ZeroDivisionError: integer division or modulo by zero
|
||||
ZeroDivisionError: division by zero
|
||||
TestResults(failed=1, attempted=1)
|
||||
|
||||
>>> _colorize.COLORIZE = save_colorize
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue