Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

unittest types not being pulled from typeshed #301

@jakebailey

Description

@jakebailey

Simplified case:

import unittest

class Simple(unittest.TestCase):
    def test_success(self):
        self.assertEqual(42, 42)

    def test_exception(self):
        with self.assertRaises(Exception) as em:
            raise Exception

These have typeshed types:

def assertEqual(self, first: Any, second: Any, msg: Any = ...) -> None: ...

@overload
    def assertRaises(self,
                     exception: Union[Type[_E], Tuple[Type[_E], ...]],
                     msg: Any = ...) -> _AssertRaisesContext[_E]: ...

But in VSC you see:

image

The parameter types aren't shown for assertEqual, and there are no type hints for em in test_exception (not shown in the screenshot).

Metadata

Metadata

Labels

bugSomething isn't workingduplicateThis issue or pull request already exists

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions