|
5 | 5 | -- Errors expected in the first run should be in the `[out1]` section, and
|
6 | 6 | -- errors expected in the second run should be in the `[out2]` section. If a
|
7 | 7 | -- section is omitted, it is expected there are no errors on that run.
|
| 8 | +-- (Note that [out] is equivalent to [out1].) |
8 | 9 | --
|
9 |
| --- As always, extra flags may be specified using |
| 10 | +-- The list of modules to be checked can be specified using |
| 11 | +-- # cmd: mypy -m mod1 mod2 mod3 |
| 12 | +-- To check a different list on the second run, use |
| 13 | +-- # cmd2: mypy -m mod1 mod3 |
| 14 | +-- |
| 15 | +-- Extra command line flags may be specified using |
10 | 16 | -- # flags: --some-flag
|
11 | 17 | -- If the second run requires different flags, those can be specified using
|
12 | 18 | -- # flags2: --another-flag
|
@@ -1924,3 +1930,116 @@ tmp/a.py:2: error: Incompatible return value type (got "str", expected "int")
|
1924 | 1930 | [out2]
|
1925 | 1931 | [rechecked a]
|
1926 | 1932 | [stale a]
|
| 1933 | + |
| 1934 | +[case testQuickAndDirty5] |
| 1935 | +# flags: --quick-and-dirty |
| 1936 | +import a, b |
| 1937 | +[file a.py] |
| 1938 | +import b |
| 1939 | +[file b.py] |
| 1940 | +import a |
| 1941 | +[file a.py.next] |
| 1942 | +import b |
| 1943 | +def foo() -> int: return '' |
| 1944 | +[out1] |
| 1945 | +[out2] |
| 1946 | +tmp/a.py:2: error: Incompatible return value type (got "str", expected "int") |
| 1947 | +[rechecked a] |
| 1948 | +[stale] |
| 1949 | + |
| 1950 | +[case testQuickAndDirty6] |
| 1951 | +# flags: --quick-and-dirty |
| 1952 | +import a, b |
| 1953 | +[file a.py] |
| 1954 | +import b |
| 1955 | +def foo() -> int: return '' |
| 1956 | +[file b.py] |
| 1957 | +import a |
| 1958 | +[file a.py.next] |
| 1959 | +import b |
| 1960 | +def foo() -> int: return 0.5 |
| 1961 | +[out1] |
| 1962 | +tmp/a.py:2: error: Incompatible return value type (got "str", expected "int") |
| 1963 | +[out2] |
| 1964 | +tmp/a.py:2: error: Incompatible return value type (got "float", expected "int") |
| 1965 | +[rechecked a] |
| 1966 | +[stale] |
| 1967 | + |
| 1968 | +[case testQuickAndDirty7] |
| 1969 | +# flags: --quick-and-dirty |
| 1970 | +import a, b |
| 1971 | +[file a.py] |
| 1972 | +import b |
| 1973 | +[file b.py] |
| 1974 | +import a |
| 1975 | +class C: pass |
| 1976 | +def f() -> int: pass |
| 1977 | +[file a.py.next] |
| 1978 | +import b |
| 1979 | +reveal_type(b.C) |
| 1980 | +reveal_type(b.f) |
| 1981 | +[out1] |
| 1982 | +[out2] |
| 1983 | +tmp/a.py:2: error: Revealed type is 'def () -> b.C' |
| 1984 | +tmp/a.py:3: error: Revealed type is 'def () -> builtins.int' |
| 1985 | +[rechecked a] |
| 1986 | +[stale] |
| 1987 | + |
| 1988 | +[case testQuickAndDirty8] |
| 1989 | +# flags: --quick-and-dirty |
| 1990 | +import a, b |
| 1991 | +[file a.py] |
| 1992 | +import b |
| 1993 | +class C: pass |
| 1994 | +def f() -> int: pass |
| 1995 | +[file b.py] |
| 1996 | +import a |
| 1997 | +[file b.py.next] |
| 1998 | +import a |
| 1999 | +reveal_type(a.C) |
| 2000 | +reveal_type(a.f) |
| 2001 | +[out1] |
| 2002 | +[out2] |
| 2003 | +tmp/b.py:2: error: Revealed type is 'def () -> a.C' |
| 2004 | +tmp/b.py:3: error: Revealed type is 'def () -> builtins.int' |
| 2005 | +[rechecked b] |
| 2006 | +[stale] |
| 2007 | + |
| 2008 | +-- (The behavior for blockers is actually no different than in regular incremental mode) |
| 2009 | +[case testQuickAndDirty9] |
| 2010 | +# noflags: --quick-and-dirty |
| 2011 | +import a, b |
| 2012 | +[file a.py] |
| 2013 | +import b |
| 2014 | +class B: pass |
| 2015 | +class C(B, B): pass # blocker |
| 2016 | +[file b.py] |
| 2017 | +import a |
| 2018 | +[file a.py.next] |
| 2019 | +import b |
| 2020 | +class B: pass |
| 2021 | +class C(B): pass |
| 2022 | +[out1] |
| 2023 | +tmp/a.py:3: error: Duplicate base class "B" |
| 2024 | +[out2] |
| 2025 | +[rechecked a, b] |
| 2026 | +[stale a, b] |
| 2027 | + |
| 2028 | +[case testQuickAndDirty10] |
| 2029 | +# noflags: --quick-and-dirty |
| 2030 | +import a, b |
| 2031 | +[file a.py] |
| 2032 | +import b |
| 2033 | +class B: pass |
| 2034 | +class C(B): pass |
| 2035 | +[file b.py] |
| 2036 | +import a |
| 2037 | +[file a.py.next] |
| 2038 | +import b |
| 2039 | +class B: pass |
| 2040 | +class C(B, B): pass # blocker |
| 2041 | +[out1] |
| 2042 | +[out2] |
| 2043 | +tmp/a.py:3: error: Duplicate base class "B" |
| 2044 | +[rechecked a, b] |
| 2045 | +[stale a, b] |
0 commit comments