MCPcopy
hub / github.com/scrapy/scrapy / test_data

Method test_data

tests/test_http_request_json.py:20–36  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

18 }
19
20 def test_data(self):
21 r1 = self.request_class(url="http://www.example.com/")
22 assert r1.body == b""
23
24 body = b"body"
25 r2 = self.request_class(url="http://www.example.com/", body=body)
26 assert r2.body == body
27
28 data = {
29 "name": "value",
30 }
31 r3 = self.request_class(url="http://www.example.com/", data=data)
32 assert r3.body == to_bytes(json.dumps(data))
33
34 # empty data
35 r4 = self.request_class(url="http://www.example.com/", data=[])
36 assert r4.body == to_bytes(json.dumps([]))
37
38 def test_data_method(self):
39 # data is not passed

Callers

nothing calls this directly

Calls 1

to_bytesFunction · 0.90

Tested by

no test coverage detected