falcon icon indicating copy to clipboard operation
falcon copied to clipboard

TestClient methods are typed to return _ResultBase, but actually return Result

Open davetapley opened this issue 5 months ago • 4 comments

All these methods are typed to return _ResultBase:

https://github.com/falconry/falcon/blob/4910dd73ecd1b9c8cf6cae045b26ad432fa56128/falcon/testing/client.py#L1041-L1046

But actually returns Result here: https://github.com/falconry/falcon/blob/4910dd73ecd1b9c8cf6cae045b26ad432fa56128/falcon/testing/client.py#L638

And Result defines the methods which are useful in testing: https://github.com/falconry/falcon/blob/4910dd73ecd1b9c8cf6cae045b26ad432fa56128/falcon/testing/client.py#L328-L348


But because it's typed _ResultBase I get e.g. Cannot access member "json" for type "_ResultBase", even though the methods work 😬

I presume this is an oversight and not intentional?

davetapley avatar Jan 31 '24 20:01 davetapley