@@ -45,8 +45,8 @@ def api_response_body():
4545 ],
4646)
4747def test_init (api_response , cls ):
48- response = cls (URL , zyte_api_response = api_response ())
49- assert response .zyte_api_response == api_response ()
48+ response = cls (URL , zyte_api = api_response ())
49+ assert response .zyte_api == api_response ()
5050
5151 assert response .url == URL
5252 assert response .status == 200
@@ -68,7 +68,7 @@ def test_init(api_response, cls):
6868)
6969def test_text_from_api_response (api_response , cls ):
7070 response = cls .from_api_response (api_response ())
71- assert response .zyte_api_response == api_response ()
71+ assert response .zyte_api == api_response ()
7272
7373 assert response .url == URL
7474 assert response .status == 200
@@ -107,18 +107,18 @@ def test_response_replace(api_response, cls):
107107 (api_response_body , ZyteAPIResponse ),
108108 ],
109109)
110- def test_response_replace_zyte_api_response (api_response , cls ):
110+ def test_response_replace_zyte_api (api_response , cls ):
111111 orig_response = cls .from_api_response (api_response ())
112112
113- # The ``zyte_api_response `` should not be replaced.
114- new_zyte_api_response = {"overridden" : "value" }
115- new_response = orig_response .replace (zyte_api_response = new_zyte_api_response )
116- assert new_response .zyte_api_response == api_response ()
113+ # The ``zyte_api `` should not be replaced.
114+ new_zyte_api = {"overridden" : "value" }
115+ new_response = orig_response .replace (zyte_api = new_zyte_api )
116+ assert new_response .zyte_api == api_response ()
117117
118118
119119def test_non_utf8_response ():
120120 content = "<html><body>Some non-ASCII ✨ chars</body></html>"
121- sample_zyte_api_response = {
121+ sample_zyte_api = {
122122 "url" : URL ,
123123 "browserHtml" : content ,
124124 "httpResponseHeaders" : [
@@ -132,7 +132,7 @@ def test_non_utf8_response():
132132 # for it. This is the default encoding for the "browserHtml" contents from
133133 # Zyte API. Thus, even if the Response Headers or <meta> tags indicate a
134134 # different encoding, it should still be treated as "utf-8".
135- response = ZyteAPITextResponse .from_api_response (sample_zyte_api_response )
135+ response = ZyteAPITextResponse .from_api_response (sample_zyte_api )
136136 assert response .text == content
137137 assert response .encoding == "utf-8"
138138
@@ -148,7 +148,7 @@ def test_response_headers_removal(api_response, cls):
148148 """Headers like 'Content-Encoding' should be removed later in the response
149149 instance returned to Scrapy.
150150
151- However, it should still be present inside 'zyte_api_response .headers'.
151+ However, it should still be present inside 'zyte_api .headers'.
152152 """
153153 additional_headers = [
154154 {"name" : "Content-Encoding" , "value" : "gzip" },
@@ -161,6 +161,5 @@ def test_response_headers_removal(api_response, cls):
161161
162162 assert response .headers == {b"X-Some-Other-Value" : [b"123" ]}
163163 assert (
164- response .zyte_api_response ["httpResponseHeaders" ]
165- == raw_response ["httpResponseHeaders" ]
164+ response .zyte_api ["httpResponseHeaders" ] == raw_response ["httpResponseHeaders" ]
166165 )
0 commit comments