summaryrefslogtreecommitdiff
path: root/tests/test_internal.py
diff options
context:
space:
mode:
authorDavid Lord <davidism@gmail.com>2019-02-13 11:44:18 -0800
committerDavid Lord <davidism@gmail.com>2019-03-08 08:01:31 -0800
commitab6150fa49afc61b0c5eed6d9545d03d1958e384 (patch)
treead5f13c9c2775ca59cc8e82ec124c4e065a65d1b /tests/test_internal.py
parent048d707d25685e6aea675c53945ceb7619e60344 (diff)
downloadwerkzeug-code-style.tar.gz
apply code stylecode-style
* reorder-python-imports * line fixers * black * flake8
Diffstat (limited to 'tests/test_internal.py')
-rw-r--r--tests/test_internal.py43
1 files changed, 22 insertions, 21 deletions
diff --git a/tests/test_internal.py b/tests/test_internal.py
index e272b58e..ca2f92cb 100644
--- a/tests/test_internal.py
+++ b/tests/test_internal.py
@@ -8,15 +8,16 @@
:copyright: 2007 Pallets
:license: BSD-3-Clause
"""
-import pytest
-
from datetime import datetime
-from warnings import filterwarnings, resetwarnings
+from warnings import filterwarnings
+from warnings import resetwarnings
-from werkzeug.wrappers import Request, Response
+import pytest
from werkzeug import _internal as internal
from werkzeug.test import create_environ
+from werkzeug.wrappers import Request
+from werkzeug.wrappers import Response
def test_date_to_unix():
@@ -28,44 +29,44 @@ def test_date_to_unix():
def test_easteregg():
- req = Request.from_values('/?macgybarchakku')
+ req = Request.from_values("/?macgybarchakku")
resp = Response.force_type(internal._easteregg(None), req)
- assert b'About Werkzeug' in resp.get_data()
- assert b'the Swiss Army knife of Python web development' in resp.get_data()
+ assert b"About Werkzeug" in resp.get_data()
+ assert b"the Swiss Army knife of Python web development" in resp.get_data()
def test_wrapper_internals():
- req = Request.from_values(data={'foo': 'bar'}, method='POST')
+ req = Request.from_values(data={"foo": "bar"}, method="POST")
req._load_form_data()
- assert req.form.to_dict() == {'foo': 'bar'}
+ assert req.form.to_dict() == {"foo": "bar"}
# second call does not break
req._load_form_data()
- assert req.form.to_dict() == {'foo': 'bar'}
+ assert req.form.to_dict() == {"foo": "bar"}
# check reprs
assert repr(req) == "<Request 'http://localhost/' [POST]>"
resp = Response()
- assert repr(resp) == '<Response 0 bytes [200 OK]>'
- resp.set_data('Hello World!')
- assert repr(resp) == '<Response 12 bytes [200 OK]>'
- resp.response = iter(['Test'])
- assert repr(resp) == '<Response streamed [200 OK]>'
+ assert repr(resp) == "<Response 0 bytes [200 OK]>"
+ resp.set_data("Hello World!")
+ assert repr(resp) == "<Response 12 bytes [200 OK]>"
+ resp.response = iter(["Test"])
+ assert repr(resp) == "<Response streamed [200 OK]>"
# unicode data does not set content length
- response = Response([u'Hällo Wörld'])
+ response = Response([u"Hällo Wörld"])
headers = response.get_wsgi_headers(create_environ())
- assert u'Content-Length' not in headers
+ assert u"Content-Length" not in headers
- response = Response([u'Hällo Wörld'.encode('utf-8')])
+ response = Response([u"Hällo Wörld".encode("utf-8")])
headers = response.get_wsgi_headers(create_environ())
- assert u'Content-Length' in headers
+ assert u"Content-Length" in headers
# check for internal warnings
- filterwarnings('error', category=Warning)
+ filterwarnings("error", category=Warning)
response = Response()
environ = create_environ()
- response.response = 'What the...?'
+ response.response = "What the...?"
pytest.raises(Warning, lambda: list(response.iter_encoded()))
pytest.raises(Warning, lambda: list(response.get_app_iter(environ)))
response.direct_passthrough = True