Skip to content
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

Undefined methods not detected due to BaseClient #4

Open
jamesls opened this issue Aug 27, 2020 · 0 comments
Open

Undefined methods not detected due to BaseClient #4

jamesls opened this issue Aug 27, 2020 · 0 comments

Comments

@jamesls
Copy link
Member

jamesls commented Aug 27, 2020

This type checks even though I would expect it to fail:

$ cat app.py
from typing import List

import botocore.session


def testit() -> List[str]:
    session = botocore.session.Session()
    client = session.create_client('s3')
    response = client.unknown_method()
    reveal_type(response)
    return [b['Name'] for b in response['Buckets']]


testit()
$ mypy app.py
Success: no issues found in 1 source file

The reveal_type is Any which explains why it type checks.

However, if I remove the BaseClient subclass in the stub definitions, then I get the error I expect:


-class S3(BaseClient):
+class S3:
     def abort_multipart_upload(self, *,
         Bucket: str,
         Key: str,
...

$ mypy app.py
app.py:9: error: "S3" has no attribute "unknown_method"
Found 1 error in 1 file (checked 1 source file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant