mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-08 16:53:23 +00:00
Format project with black (#467)
Format with line length 110 to match flake8 make black part of linting check Update travis spec for updated black requirements Add diff output for black on failure update changelog
This commit is contained in:
@@ -9,10 +9,7 @@ from vcr.stubs import VCRHTTPResponse
|
||||
|
||||
def test_response_should_have_headers_field():
|
||||
recorded_response = {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 200
|
||||
},
|
||||
"status": {"message": "OK", "code": 200},
|
||||
"headers": {
|
||||
"content-length": ["0"],
|
||||
"server": ["gunicorn/18.0"],
|
||||
@@ -22,9 +19,7 @@ def test_response_should_have_headers_field():
|
||||
"access-control-allow-origin": ["*"],
|
||||
"content-type": ["text/html; charset=utf-8"],
|
||||
},
|
||||
"body": {
|
||||
"string": b""
|
||||
}
|
||||
"body": {"string": b""},
|
||||
}
|
||||
response = VCRHTTPResponse(recorded_response)
|
||||
|
||||
@@ -33,19 +28,14 @@ def test_response_should_have_headers_field():
|
||||
|
||||
def test_response_headers_should_be_equal_to_msg():
|
||||
recorded_response = {
|
||||
"status": {
|
||||
"message": b"OK",
|
||||
"code": 200
|
||||
},
|
||||
"status": {"message": b"OK", "code": 200},
|
||||
"headers": {
|
||||
"content-length": ["0"],
|
||||
"server": ["gunicorn/18.0"],
|
||||
"connection": ["Close"],
|
||||
"content-type": ["text/html; charset=utf-8"],
|
||||
},
|
||||
"body": {
|
||||
"string": b""
|
||||
}
|
||||
"body": {"string": b""},
|
||||
}
|
||||
response = VCRHTTPResponse(recorded_response)
|
||||
|
||||
@@ -54,23 +44,18 @@ def test_response_headers_should_be_equal_to_msg():
|
||||
|
||||
def test_response_headers_should_have_correct_values():
|
||||
recorded_response = {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 200
|
||||
},
|
||||
"status": {"message": "OK", "code": 200},
|
||||
"headers": {
|
||||
"content-length": ["10806"],
|
||||
"date": ["Fri, 24 Oct 2014 18:35:37 GMT"],
|
||||
"content-type": ["text/html; charset=utf-8"],
|
||||
},
|
||||
"body": {
|
||||
"string": b""
|
||||
}
|
||||
"body": {"string": b""},
|
||||
}
|
||||
response = VCRHTTPResponse(recorded_response)
|
||||
|
||||
assert response.headers.get('content-length') == "10806"
|
||||
assert response.headers.get('date') == "Fri, 24 Oct 2014 18:35:37 GMT"
|
||||
assert response.headers.get("content-length") == "10806"
|
||||
assert response.headers.get("date") == "Fri, 24 Oct 2014 18:35:37 GMT"
|
||||
|
||||
|
||||
@unittest.skipIf(six.PY2, "Regression test for Python3 only")
|
||||
@@ -80,10 +65,7 @@ def test_response_parses_correctly_and_fp_attribute_error_is_not_thrown():
|
||||
:return:
|
||||
"""
|
||||
recorded_response = {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 200
|
||||
},
|
||||
"status": {"message": "OK", "code": 200},
|
||||
"headers": {
|
||||
"content-length": ["0"],
|
||||
"server": ["gunicorn/18.0"],
|
||||
@@ -95,28 +77,27 @@ def test_response_parses_correctly_and_fp_attribute_error_is_not_thrown():
|
||||
},
|
||||
"body": {
|
||||
"string": b"\nPMID- 19416910\nOWN - NLM\nSTAT- MEDLINE\nDA - 20090513\nDCOM- "
|
||||
b"20090622\nLR - "
|
||||
b"20141209\nIS - 1091-6490 (Electronic)\nIS - 0027-8424 (Linking)\nVI - "
|
||||
b"106\nIP - "
|
||||
b"19\nDP - 2009 May 12\nTI - Genetic dissection of histone deacetylase "
|
||||
b"requirement in "
|
||||
b"tumor cells.\nPG - 7751-5\nLID - 10.1073/pnas.0903139106 [doi]\nAB - "
|
||||
b"Histone "
|
||||
b"deacetylase inhibitors (HDACi) represent a new group of drugs currently\n "
|
||||
b" being "
|
||||
b"tested in a wide variety of clinical applications. They are especially\n "
|
||||
b" effective "
|
||||
b"in preclinical models of cancer where they show antiproliferative\n "
|
||||
b"action in many "
|
||||
b"different types of cancer cells. Recently, the first HDACi was\n "
|
||||
b"approved for the "
|
||||
b"treatment of cutaneous T cell lymphomas. Most HDACi currently in\n "
|
||||
b"clinical "
|
||||
|
||||
}
|
||||
b"20090622\nLR - "
|
||||
b"20141209\nIS - 1091-6490 (Electronic)\nIS - 0027-8424 (Linking)\nVI - "
|
||||
b"106\nIP - "
|
||||
b"19\nDP - 2009 May 12\nTI - Genetic dissection of histone deacetylase "
|
||||
b"requirement in "
|
||||
b"tumor cells.\nPG - 7751-5\nLID - 10.1073/pnas.0903139106 [doi]\nAB - "
|
||||
b"Histone "
|
||||
b"deacetylase inhibitors (HDACi) represent a new group of drugs currently\n "
|
||||
b" being "
|
||||
b"tested in a wide variety of clinical applications. They are especially\n "
|
||||
b" effective "
|
||||
b"in preclinical models of cancer where they show antiproliferative\n "
|
||||
b"action in many "
|
||||
b"different types of cancer cells. Recently, the first HDACi was\n "
|
||||
b"approved for the "
|
||||
b"treatment of cutaneous T cell lymphomas. Most HDACi currently in\n "
|
||||
b"clinical "
|
||||
},
|
||||
}
|
||||
vcr_response = VCRHTTPResponse(recorded_response)
|
||||
handle = io.TextIOWrapper(io.BufferedReader(vcr_response), encoding='utf-8')
|
||||
handle = io.TextIOWrapper(io.BufferedReader(vcr_response), encoding="utf-8")
|
||||
handle = iter(handle)
|
||||
articles = [line for line in handle]
|
||||
assert len(articles) > 1
|
||||
|
||||
Reference in New Issue
Block a user