Skip to content

Enable a bunch of skipped tests #8024

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Nov 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions mypy/test/testparse.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
"""Tests for the mypy parser."""

import sys

from pytest import skip # type: ignore[import]

from mypy import defaults
from mypy.test.helpers import assert_string_arrays_equal
from mypy.test.helpers import assert_string_arrays_equal, parse_options
from mypy.test.data import DataDrivenTestCase, DataSuite
from mypy.parse import parse
from mypy.errors import CompileError
Expand Down Expand Up @@ -60,9 +64,12 @@ def run_case(self, testcase: DataDrivenTestCase) -> None:

def test_parse_error(testcase: DataDrivenTestCase) -> None:
try:
options = parse_options('\n'.join(testcase.input), testcase, 0)
if options.python_version != sys.version_info[:2]:
skip()
# Compile temporary file. The test file contains non-ASCII characters.
parse(bytes('\n'.join(testcase.input), 'utf-8'), INPUT_FILE_NAME, '__main__', None,
Options())
options)
raise AssertionError('No errors reported')
except CompileError as e:
if e.module_with_blocker is not None:
Expand Down
2 changes: 1 addition & 1 deletion test-data/unit/check-generics.test
Original file line number Diff line number Diff line change
Expand Up @@ -1608,7 +1608,7 @@ def g3(f: Callable[[object], object]) -> None: pass
g3(f) # E: Argument 1 to "g3" has incompatible type "Callable[[T], T]"; \
expected "Callable[[object], object]"

[case testSubtypingWithGenericFunctionUsingTypevarWithValues2-skip]
[case testSubtypingWithGenericFunctionUsingTypevarWithValues2]
from typing import TypeVar, Callable
T = TypeVar('T', int, str)
def f(x: T) -> T: pass
Expand Down
5 changes: 2 additions & 3 deletions test-data/unit/check-incremental.test
Original file line number Diff line number Diff line change
Expand Up @@ -3600,8 +3600,7 @@ x = 1
[file b.py.2]
x = '2'

-- TODO: Fails due to #4856
[case testImportUnusedIgnore2-skip]
[case testImportUnusedIgnore2]
# flags: --warn-unused-ignores
import a
[file a.py]
Expand All @@ -3616,7 +3615,7 @@ pass
[out]
[out2]
[out3]
tmp/a.py:1: note: unused 'type: ignore' comment
tmp/a.py:2: error: unused 'type: ignore' comment

-- Test that a non cache_fine_grained run can use a fine-grained cache
[case testRegularUsesFgCache]
Expand Down
5 changes: 2 additions & 3 deletions test-data/unit/check-inference.test
Original file line number Diff line number Diff line change
Expand Up @@ -2400,9 +2400,8 @@ class C(B):
reveal_type(B.x) # N: Revealed type is 'None'
reveal_type(C.x) # N: Revealed type is 'None'

[case testLocalPartialTypesWithInheritance2-skip]
[case testLocalPartialTypesWithInheritance2]
# flags: --local-partial-types
# This is failing because of https://github.com/python/mypy/issues/4552
from typing import Optional

class X: pass
Expand All @@ -2415,7 +2414,7 @@ class B(A):
x = None
x = Y()

reveal_type(B.x) # E: revealed type is 'Union[__main__.Y, None]'
reveal_type(B.x) # N: Revealed type is 'Union[__main__.Y, None]'

[case testLocalPartialTypesBinderSpecialCase]
# flags: --local-partial-types
Expand Down
34 changes: 19 additions & 15 deletions test-data/unit/check-isinstance.test
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,27 @@ def f(x: Union[int, str, List]) -> None:
reveal_type(x) # N: Revealed type is 'Union[builtins.int, builtins.str, builtins.list[Any]]'
[builtins fixtures/isinstancelist.pyi]

[case testClassAttributeInitialization-skip]
[case testClassAttributeInitialization]
class A:
x = None # type: int
def __init__(self) -> None:
self.y = None # type: int
z = self.x
w = self.y

[case testAssignmentSubtypes-skip]
[case testAssignmentSubtypes]
from typing import Union

def foo(x: Union[str, int]):
if isinstance(x, int):
x = 'a'
x + 'a' # Works in the current code
z = x # We probably want this to be of type str.
y = [x] # But what type should this be?
y[0] + 'a' # (1) Should this work?
y + [1] # (2) Or this?
z = 1 # Also, is this valid?
x + 'a'
z = x
y = [x]
y[0] + 'a'
# TODO: should we allow these two lines?
y + [1] # E: List item 0 has incompatible type "int"; expected "str"
z = 1 # E: Incompatible types in assignment (expression has type "int", variable has type "str")

x = None # type: int
y = [x]
Expand Down Expand Up @@ -116,9 +117,9 @@ if int():
x.z # E: "A" has no attribute "z"
x.y

[case testSingleMultiAssignment-skip]
[case testSingleMultiAssignment]
x = 'a'
(x, ) = ('a',)
(x,) = ('a',)

[case testUnionMultiAssignment]
from typing import Union
Expand Down Expand Up @@ -595,22 +596,23 @@ assert isinstance(b, (A, B, C))
reveal_type(b) # N: Revealed type is 'Union[__main__.A, __main__.B]'
[builtins fixtures/isinstance.pyi]

[case testMemberAssignmentChanges-skip]
[case testMemberAssignmentChanges]
from typing import Union

class Dog:
paws = 1 # type: Union[int, str]

pet = Dog()

pet.paws + 'a' # E: moo
pet.paws + 'a' # E: Unsupported operand types for + ("int" and "str") \
# N: Left operand is of type "Union[int, str]"
pet.paws = 'a'
pet.paws + 'a'
pet.paws = 1
pet.paws + 1
[builtins fixtures/isinstancelist.pyi]

[case testIsInstanceSubClassMemberHard-skip]
[case testIsInstanceSubClassMemberHard]
from typing import Union

class Animal:
Expand All @@ -630,7 +632,9 @@ h.pet = Dog()
if isinstance(h.pet, Dog):
if isinstance(h.pet.paws, str):
for i in [1]:
h.pet.paws + 'a'
# TODO: should we allow this if iterable is of length one or zero?
h.pet.paws + 'a' # E: Unsupported operand types for + ("int" and "str") \
# N: Left operand is of type "Union[int, str]"
if bool():
break
h.pet.paws = 1
Expand Down Expand Up @@ -1314,7 +1318,7 @@ def f(x: Union[A, B]) -> None:
[builtins fixtures/isinstance.pyi]

[case testIsinstanceWithOverlappingPromotionTypes-skip]
# Currently disabled: see https://github.com/python/mypy/issues/6180 for context
# Currently disabled: see https://github.com/python/mypy/issues/6060 for context
from typing import Union

class FloatLike: pass
Expand Down
6 changes: 1 addition & 5 deletions test-data/unit/check-literal.test
Original file line number Diff line number Diff line change
Expand Up @@ -3015,11 +3015,7 @@ expects_int(c)
expects_int(d) # E: Argument 1 to "expects_int" has incompatible type "Literal[D.FOO]"; expected "int"
[out]

[case testLiteralWithEnumsAliases-skip]
# TODO: Fix this test once https://github.com/python/mypy/issues/6667 is resolved.
#
# The linked issue is about nested classes, but the same root bug prevents aliases
# to enums from working.
[case testLiteralWithEnumsAliases]
from typing_extensions import Literal
from enum import Enum

Expand Down
13 changes: 5 additions & 8 deletions test-data/unit/check-modules.test
Original file line number Diff line number Diff line change
Expand Up @@ -568,10 +568,10 @@ x = ''
[file m2.py]
x = 1

[case testStarImportOverridingLocalImports-skip]
[case testStarImportOverridingLocalImports]
from m1 import *
from m2 import *
x = '' # E: TODO (cannot assign str to int)
x = '' # E: Incompatible types in assignment (expression has type "str", variable has type "int")
[file m1.py]
x = 1
[file m2.py]
Expand Down Expand Up @@ -2240,9 +2240,7 @@ reveal_type(x) # N: Revealed type is 'builtins.str'
x = str()
y = int()

[case testForwardReferenceToListAlias-skip]
# TODO: This fails because of missing ImportedName handling in
# mypy.typeanal.TypeAnalyser.visit_unbound_type.
[case testForwardReferenceToListAlias]
x: List[int]
reveal_type(x) # N: Revealed type is 'builtins.list[builtins.int]'
def f() -> 'List[int]': pass
Expand Down Expand Up @@ -2391,16 +2389,15 @@ ignore_missing_imports = True
main:3: error: Cannot find implementation or library stub for module named 'a.b.d'
main:3: note: See https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports

[case testIndirectFromImportWithinCycleUsedAsBaseClass-skip]
-- TODO: Fails because of missing ImportedName handling in mypy.typeanal
[case testIndirectFromImportWithinCycleUsedAsBaseClass]
import a
[file a.py]
from b import f
from c import B
[file b.py]
from c import y
class A(B): pass
reveal_type(A().x) # N: Revealed type is 'builtins.str'
reveal_type(A().x) # N: Revealed type is 'builtins.int'
from a import B
def f() -> None: pass
[file c.py]
Expand Down
3 changes: 1 addition & 2 deletions test-data/unit/deps-expressions.test
Original file line number Diff line number Diff line change
Expand Up @@ -282,15 +282,14 @@ def f() -> int:
<m.B.__new__> -> m.f
<m.B> -> <m.A.__lt__>, m.A.__lt__, m.B, m.f

[case testIsOp-skip]
[case testIsOp]
class A: pass
class B: pass

def f() -> bool:
return A() is B()
[builtins fixtures/bool.pyi]
[out]
-- fails because of https://github.com/python/mypy/issues/4055
<m.A.__init__> -> m.f
<m.A.__new__> -> m.f
<m.A> -> m.A, m.f
Expand Down
5 changes: 2 additions & 3 deletions test-data/unit/fine-grained.test
Original file line number Diff line number Diff line change
Expand Up @@ -590,8 +590,7 @@ class C:
==
a.py:2: error: Incompatible types in assignment (expression has type "str", variable has type "int")

[case testIgnoredAttrReprocessedModule-skip]
# See https://github.com/python/mypy/issues/4782
[case testIgnoredAttrReprocessedModule]
import a
[file a.py]
import b
Expand Down Expand Up @@ -6860,7 +6859,7 @@ from typing import overload
==
main:3: error: Module has no attribute "f"

[case testOverloadsUpdatedTypeRecheckImplementation-skip]
[case testOverloadsUpdatedTypeRecheckImplementation]
from typing import overload
import mod
class Outer:
Expand Down
11 changes: 9 additions & 2 deletions test-data/unit/parse-errors.test
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,17 @@ file:3: error: syntax error in type comment
file:3: error: Inconsistent use of '*' in function signature
file:3: error: Inconsistent use of '**' in function signature

[case testPrintStatementInPython3-skip]
[case testPrintStatementInPython35]
# flags: --python-version 3.5
print 1
[out]
file:1: error: Missing parentheses in call to 'print'
file:2: error: Missing parentheses in call to 'print'

[case testPrintStatementInPython37]
# flags: --python-version 3.7
print 1
[out]
file:2: error: Missing parentheses in call to 'print'. Did you mean print(1)?

[case testInvalidConditionInConditionalExpression]
1 if 2, 3 else 4
Expand Down
3 changes: 1 addition & 2 deletions test-data/unit/parse-python2.test
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ MypyFile:1(
ExpressionStmt:3(
IntExpr(255)))

[case testLongLiteral-skip]
# see typed_ast issue #26
[case testLongLiteral]
0L
123L
012L
Expand Down
3 changes: 1 addition & 2 deletions test-data/unit/pythoneval.test
Original file line number Diff line number Diff line change
Expand Up @@ -625,8 +625,7 @@ f(tuple())
[out]
()

[case testMapWithLambdaSpecialCase-skip]
# TODO: Fix this; this was broken at some point but not sure why.
[case testMapWithLambdaSpecialCase]
from typing import List, Iterator
a = [[1], [3]]
b = map(lambda y: y[0], a)
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy