I am reading Flask's tutorial about testing. There's such code there:
rv = self.app.get('/')
assert 'No entries here so far' in rv.data
My question is: why is there a variable called rv
? What does this abbreviation mean?
I've been looking for it in Flask source code for a while, and I found several variables called that way:
app_rv = app(environ, start_response)
and
rv = run_wsgi_app(self.application, environ, buffered=buffered)
But, as you can see, rv
here is not even possibly related to rv
as response object in testing.
I've been able to find out that "r" stays probably for "response", but what does the "v" mean?
Flask provides a way to test your application by exposing the Werkzeug test Client and handling the context locals for you. You can then use that with your favourite testing solution.
It says just below that code snippet in your link you provided:
By using self.app.get we can send an HTTP GET request to the application with the given path. The return value will be a response_class object.
So rv
is just short for return value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With