Created
September 6, 2022 20:14
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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