Skip to content

Commit b060c2d

Browse files
Check functions without annotations in mypyc tests (#19792)
c.f. #19217 (comment)
1 parent 1a04c07 commit b060c2d

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

mypyc/test-data/fixtures/ir.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def __delattr__(self, k: str) -> None: pass
5151
class type:
5252
def __init__(self, o: object) -> None: ...
5353
def __or__(self, o: object) -> Any: ...
54+
def __new__(cls, *args: object) -> Any: ...
5455
__name__ : str
5556
__annotations__: Dict[str, Any]
5657

mypyc/test-data/run-classes.test

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,7 @@ def test_classmethod_with_allow_interpreted() -> None:
852852

853853
[file interp.py]
854854
def make_interpreted_subclass(base):
855-
class Sub(base):
855+
class Sub(base): # type: ignore[misc, valid-type]
856856
@classmethod
857857
def g(cls, x: int) -> int:
858858
return x + 3
@@ -2514,7 +2514,7 @@ def test_interpreted_subclass() -> None:
25142514
from testutil import assertRaises
25152515

25162516
def define_interpreted_subclass(b):
2517-
class DerivedInterpreted1(b):
2517+
class DerivedInterpreted1(b): # type: ignore[misc, valid-type]
25182518
def __init__(self):
25192519
# Don't call base class __init__
25202520
pass
@@ -2527,10 +2527,10 @@ def define_interpreted_subclass(b):
25272527
with assertRaises(AttributeError):
25282528
del d1.x
25292529

2530-
class DerivedInterpreted1(b):
2530+
class DerivedInterpreted2(b): # type: ignore[misc, valid-type]
25312531
def __init__(self):
25322532
super().__init__('y')
2533-
d2 = DerivedInterpreted1()
2533+
d2 = DerivedInterpreted2()
25342534
assert d2.x == 5
25352535
assert d2.s == 'y'
25362536
with assertRaises(AttributeError):

mypyc/test/test_run.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ def run_case_step(self, testcase: DataDrivenTestCase, incremental_step: int) ->
210210
options.preserve_asts = True
211211
options.allow_empty_bodies = True
212212
options.incremental = self.separate
213+
options.check_untyped_defs = True
213214

214215
# Avoid checking modules/packages named 'unchecked', to provide a way
215216
# to test interacting with code we don't have types for.

0 commit comments

Comments
 (0)