Skip to content

Instantly share code, notes, and snippets.

@noxasaxon
Created September 6, 2022 20:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noxasaxon/baa02203cf7df490eb42d7186a0dae8c to your computer and use it in GitHub Desktop.
Save noxasaxon/baa02203cf7df490eb42d7186a0dae8c to your computer and use it in GitHub Desktop.
testing result library's as_result decorator, which VsCode shows type errors even though it runs fine. The type errors go away if this code is in the actual result library repo
from result import as_result
import requests
def test_as_result_3rd_party_fn() -> None:
"""
The ``as_result()`` is a signature-preserving decorator.
"""
request_nt = as_result(BaseException)(requests.request)
test = request_nt(method="GET", url="http://google.com")
print(test.unwrap())
test_as_result_3rd_party_fn()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment