Skip to content

Commit

Permalink
Update mypyc test output for Python 3.13 (#17508)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p authored Jul 8, 2024
1 parent 4e3346e commit acc65b5
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 1 deletion.
86 changes: 86 additions & 0 deletions mypyc/test-data/run-exceptions.test
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,43 @@ Traceback (most recent call last):
File "native.py", line 23, in __init__
raise Exception
Exception
[out version>=3.13]
Traceback (most recent call last):
File "driver.py", line 4, in <module>
f([])
~^^^^
File "native.py", line 3, in f
g(x)
File "native.py", line 6, in g
x[5] = 2
IndexError: list assignment index out of range
Traceback (most recent call last):
File "driver.py", line 8, in <module>
r1()
~~^^
File "native.py", line 10, in r1
q1()
File "native.py", line 13, in q1
raise Exception("test")
Exception: test
Traceback (most recent call last):
File "driver.py", line 12, in <module>
r2()
~~^^
File "native.py", line 16, in r2
q2()
File "native.py", line 19, in q2
raise Exception
Exception
Traceback (most recent call last):
File "driver.py", line 16, in <module>
hey()
~~~^^
File "native.py", line 26, in hey
A()
File "native.py", line 23, in __init__
raise Exception
Exception

[case testTryExcept]
from typing import Any, Iterator
Expand Down Expand Up @@ -264,6 +301,55 @@ attr! -- 'object' object has no attribute 'lol'
out!
== l ==
key! -- 0
[out version>=3.13]
== i ==
<class 'IndexError'>
Traceback (most recent call last):
File "driver.py", line 6, in <module>
i()
~^^
File "native.py", line 44, in i
r(0)
File "native.py", line 15, in r
[0][1]
IndexError: list index out of range
== k ==
Traceback (most recent call last):
File "native.py", line 59, in k
r(1)
File "native.py", line 17, in r
raise Exception('hi')
Exception: hi

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "driver.py", line 12, in <module>
k()
~^^
File "native.py", line 61, in k
r(0)
File "native.py", line 15, in r
[0][1]
IndexError: list index out of range
== g ==
caught!
caught!
== f ==
hi
None
list index out of range
None
== h ==
gonna break
None
== j ==
lookup!
lookup!
attr! -- 'object' object has no attribute 'lol'
out!
== l ==
key! -- 0

[case testTryFinally]
from typing import Any
Expand Down
35 changes: 35 additions & 0 deletions mypyc/test-data/run-loops.test
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,41 @@ RuntimeError: dictionary changed size during iteration
1
2
3
[out version>=3.13]
Traceback (most recent call last):
File "driver.py", line 16, in <module>
iterate_over_any(5)
~~~~~~~~~~~~~~~~^^^
File "native.py", line 6, in iterate_over_any
for element in a:
TypeError: 'int' object is not iterable
Traceback (most recent call last):
File "driver.py", line 20, in <module>
iterate_over_iterable(broken_generator(5))
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
File "native.py", line 10, in iterate_over_iterable
for element in iterable:
File "driver.py", line 8, in broken_generator
raise Exception('Exception Manually Raised')
Exception: Exception Manually Raised
Traceback (most recent call last):
File "driver.py", line 24, in <module>
iterate_and_delete(d)
~~~~~~~~~~~~~~~~~~^^^
File "native.py", line 14, in iterate_and_delete
for key in d:
RuntimeError: dictionary changed size during iteration
15
6
3
0
1
2
3
4
1
2
3

[case testContinueFor]
def f() -> None:
Expand Down
5 changes: 4 additions & 1 deletion mypyc/test-data/run-misc.test
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,10 @@ print(z)
[case testCheckVersion]
import sys

if sys.version_info[:2] == (3, 12):
if sys.version_info[:2] == (3, 13):
def version() -> int:
return 13
elif sys.version_info[:2] == (3, 12):
def version() -> int:
return 12
elif sys.version_info[:2] == (3, 11):
Expand Down
17 changes: 17 additions & 0 deletions mypyc/test-data/run-multimodule.test
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,23 @@ Traceback (most recent call last):
File "other.py", line 3, in fail2
x[2] = 2
IndexError: list assignment index out of range
[out version>=3.13]
Traceback (most recent call last):
File "driver.py", line 6, in <module>
other.fail2()
~~~~~~~~~~~^^
File "other.py", line 3, in fail2
x[2] = 2
IndexError: list assignment index out of range
Traceback (most recent call last):
File "driver.py", line 12, in <module>
native.fail()
~~~~~~~~~~~^^
File "native.py", line 4, in fail
fail2()
File "other.py", line 3, in fail2
x[2] = 2
IndexError: list assignment index out of range

[case testMultiModuleCycle]
if False:
Expand Down

0 comments on commit acc65b5

Please sign in to comment.