Skip to content

Commit d5e4a47

Browse files
committed
Update test cases to pass
1 parent 4f319bb commit d5e4a47

File tree

5 files changed

+24
-17
lines changed

5 files changed

+24
-17
lines changed

mypyc/test-data/irbuild-match.test

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,8 +1765,10 @@ def f(x):
17651765
r10 :: object
17661766
r11 :: object[1]
17671767
r12 :: object_ptr
1768-
r13 :: object
1769-
r14 :: bool
1768+
r13, r14 :: object
1769+
r15 :: i32
1770+
r16 :: bit
1771+
r17, r18 :: bool
17701772
L0:
17711773
r0 = __main__.Foo :: type
17721774
r1 = PyObject_IsInstance(x, r0)
@@ -1790,9 +1792,13 @@ L2:
17901792
goto L8
17911793
L3:
17921794
L4:
1793-
if 0 goto L6 else goto L5 :: bool
1795+
r14 = box(bool, 0)
1796+
r15 = PyObject_IsTrue(r14)
1797+
r16 = r15 >= 0 :: signed
1798+
r17 = truncate r15: i32 to builtins.bool
1799+
if r17 goto L6 else goto L5 :: bool
17941800
L5:
1795-
r14 = raise AssertionError('Unreachable')
1801+
r18 = raise AssertionError('Unreachable')
17961802
unreachable
17971803
L6:
17981804
goto L8

test-data/unit/daemon.test

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,8 @@ $ dmypy inspect foo.py:1:2:3:4
463463
Can't find expression at span 1:2:3:4
464464
== Return code: 1
465465
$ dmypy inspect foo.py:17:5:17:5
466-
"int"
466+
No known type available for "NameExpr" (maybe unreachable or try --force-reload)
467+
== Return code: 1
467468

468469
[file foo.py]
469470
from typing import Optional
@@ -522,8 +523,9 @@ $ dmypy inspect foo.py:1:2
522523
Can't find any expressions at position 1:2
523524
== Return code: 1
524525
$ dmypy inspect foo.py:11:5 --force-reload
525-
"int"
526-
"int"
526+
No known type available for "NameExpr" (maybe unreachable)
527+
No known type available for "OpExpr" (maybe unreachable)
528+
== Return code: 1
527529

528530
[file foo.py]
529531
from typing import Optional
@@ -545,7 +547,8 @@ $ dmypy check foo.py bar.py --export-types
545547
$ dmypy inspect foo.py:9:1 --show attrs --include-span --include-kind -vv
546548
NameExpr:9:1:9:1 -> {"foo.C": ["a", "x", "y"], "foo.B": ["a", "b"]}
547549
$ dmypy inspect foo.py:11:10 --show attrs
548-
{"str": ["__add__", "__contains__", "__eq__", "__ge__", "__getitem__", "__getnewargs__", "__gt__", "__hash__", "__iter__", "__le__", "__len__", "__lt__", "__mod__", "__mul__", "__ne__", "__new__", "__rmul__", "capitalize", "casefold", "center", "count", "encode", "endswith", "expandtabs", "find", "format", "format_map", "index", "isalnum", "isalpha", "isascii", "isdecimal", "isdigit", "isidentifier", "islower", "isnumeric", "isprintable", "isspace", "istitle", "isupper", "join", "ljust", "lower", "lstrip", "maketrans", "partition", "removeprefix", "removesuffix", "replace", "rfind", "rindex", "rjust", "rpartition", "rsplit", "rstrip", "split", "splitlines", "startswith", "strip", "swapcase", "title", "translate", "upper", "zfill"], "Sequence": ["__contains__", "__getitem__", "__iter__", "__reversed__", "count", "index"], "Reversible": ["__reversed__"], "Collection": ["__len__"], "Iterable": ["__iter__"], "Container": ["__contains__"]}
550+
No known type available for "StrExpr" (maybe unreachable or try --force-reload)
551+
== Return code: 1
549552
$ dmypy inspect foo.py:1:1 --show attrs
550553
Can't find any expressions at position 1:1
551554
== Return code: 1

test-data/unit/fine-grained.test

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9692,7 +9692,8 @@ reveal_type(z)
96929692
[out]
96939693
c.py:2: note: Revealed type is "a.<subclass of "a.A" and "a.B">"
96949694
==
9695-
c.py:2: note: Revealed type is "Never"
9695+
c.py:2: note: Revealed type is "Any"
9696+
b.py:2: error: Cannot determine type of "y"
96969697

96979698
[case testIsInstanceAdHocIntersectionFineGrainedIncrementalUnreachableToIntersection]
96989699
import c
@@ -9723,7 +9724,8 @@ from b import z
97239724
reveal_type(z)
97249725
[builtins fixtures/isinstance.pyi]
97259726
[out]
9726-
c.py:2: note: Revealed type is "Never"
9727+
b.py:2: error: Cannot determine type of "y"
9728+
c.py:2: note: Revealed type is "Any"
97279729
==
97289730
c.py:2: note: Revealed type is "a.<subclass of "a.A" and "a.B">"
97299731

test-data/unit/pythoneval.test

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,10 +1481,8 @@ if isinstance(x, int):
14811481
[out]
14821482
_testIsInstanceAdHocIntersectionWithStrAndBytes.py:3: error: Subclass of "str" and "bytes" cannot exist: would have incompatible method signatures
14831483
_testIsInstanceAdHocIntersectionWithStrAndBytes.py:4: error: Statement is unreachable
1484-
_testIsInstanceAdHocIntersectionWithStrAndBytes.py:4: note: Revealed type is "Never"
14851484
_testIsInstanceAdHocIntersectionWithStrAndBytes.py:6: error: Subclass of "str" and "int" cannot exist: would have incompatible method signatures
14861485
_testIsInstanceAdHocIntersectionWithStrAndBytes.py:7: error: Statement is unreachable
1487-
_testIsInstanceAdHocIntersectionWithStrAndBytes.py:7: note: Revealed type is "Never"
14881486

14891487
[case testAsyncioFutureWait]
14901488
# mypy: strict-optional
@@ -1555,7 +1553,6 @@ if isinstance(obj, Awaitable):
15551553
[out]
15561554
_testSpecialTypingProtocols.py:6: note: Revealed type is "Tuple[builtins.int]"
15571555
_testSpecialTypingProtocols.py:8: error: Statement is unreachable
1558-
_testSpecialTypingProtocols.py:8: note: Revealed type is "Never"
15591556

15601557
[case testTypeshedRecursiveTypesExample]
15611558
from typing import List, Union

test-data/unit/reports.test

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,7 @@ def bar(x):
235235
<span class="line-any" title="Any Types on this line:
236236
Explicit (x1)"> any_f(x)</span>
237237
<span class="line-precise" title="No Anys on this line!"> assert False</span>
238-
<span class="line-any" title="Any Types on this line:
239-
Explicit (x1)"> any_f(x)</span>
238+
<span class="line-unanalyzed" title="No Anys on this line!"> any_f(x)</span>
240239
</pre></td>
241240
</tr></tbody>
242241
</table>
@@ -297,10 +296,10 @@ def bar(x):
297296
[outfile report/any-exprs.txt]
298297
Name Anys Exprs Coverage
299298
---------------------------------
300-
i 0 8 100.00%
299+
i 1 6 83.33%
301300
j 0 5 100.00%
302301
---------------------------------
303-
Total 0 13 100.00%
302+
Total 1 11 90.91%
304303

305304
[case testAnyExprReportHigherKindedTypesAreNotAny]
306305
# cmd: mypy --any-exprs-report report i.py

0 commit comments

Comments
 (0)