Skip to content

Commit 7423456

Browse files
committed
more test fixes
1 parent b86b015 commit 7423456

File tree

6 files changed

+6
-7
lines changed

6 files changed

+6
-7
lines changed

mypy/test/typefixture.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ def __init__(self, variance: int = COVARIANT) -> None:
2727
self.oi = self.make_type_info('builtins.object') # class object
2828
self.o = Instance(self.oi, []) # object
2929

30-
# The 'bool' class
31-
self.bool_type_info = self.make_type_info('builtins.bool')
32-
3330
# Type variables (these are effectively global)
3431

3532
def make_type_var(name: str, id: int, values: List[Type], upper_bound: Type,
@@ -66,6 +63,8 @@ def make_type_var(name: str, id: int, values: List[Type], upper_bound: Type,
6663
typevars=['T'],
6764
variances=[COVARIANT]) # class tuple
6865
self.type_typei = self.make_type_info('builtins.type') # class type
66+
self.bool_type_info = self.make_type_info('builtins.bool')
67+
self._add_bool_dunder(self.bool_type_info)
6968
self.functioni = self.make_type_info('builtins.function') # function TODO
7069
self.ai = self.make_type_info('A', mro=[self.oi]) # class A
7170
self._add_bool_dunder(self.ai)

mypy/typeops.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ def get_type_special_method_bool_ret_type(t: Type) -> Optional[Type]:
392392
t = get_proper_type(t)
393393

394394
if isinstance(t, Instance):
395-
bool_method = t.type.names.get("__bool__", None)
395+
bool_method = t.type.get("__bool__")
396396
if bool_method:
397397
callee = get_proper_type(bool_method.type)
398398
if isinstance(callee, CallableType):

pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ python_classes =
1919
python_functions =
2020

2121
# always run in parallel (requires pytest-xdist, see test-requirements.txt)
22-
addopts = -nauto
22+
# addopts = -nauto
2323

2424
# treat xpasses as test failures so they get converted to regular tests as soon as possible
2525
xfail_strict = true

test-data/unit/fixtures/bool.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class type: pass
1111
class tuple(Generic[T]): pass
1212
class function: pass
1313
class int:
14-
def __bool__(self) -> bool: pass
14+
def __bool__(self) -> 'bool': pass
1515
class bool(int): pass
1616
class float: pass
1717
class str:

test-data/unit/fixtures/ops.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class str:
3030
def __init__(self, x: 'int') -> None: pass
3131
def __add__(self, x: 'str') -> 'str': pass
3232
def __eq__(self, x: object) -> bool: pass
33+
def __len__(self) -> int: pass
3334
def startswith(self, x: 'str') -> bool: pass
3435
def strip(self) -> 'str': pass
3536

test-data/unit/fixtures/primitives.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ class str(Sequence[str]):
2626
def __add__(self, s: str) -> str: pass
2727
def __iter__(self) -> Iterator[str]: pass
2828
def __contains__(self, other: object) -> bool: pass
29-
def __len__(self) -> int: pass
3029
def __getitem__(self, item: int) -> str: pass
3130
def format(self, *args, **kwargs) -> str: pass
3231
class bytes(Sequence[int]):

0 commit comments

Comments
 (0)