MCPcopy
hub / github.com/scrapy/scrapy / test_body_or_str

Method test_body_or_str

tests/test_utils_iterators.py:522–530  ·  view source on GitHub ↗
(self, obj: Response | str | bytes)

Source from the content-addressed store, hash-verified

520 ],
521 )
522 def test_body_or_str(self, obj: Response | str | bytes) -> None:
523 r1 = _body_or_str(obj)
524 self._assert_type_and_value(r1, self.ubody, obj)
525 r2 = _body_or_str(obj, unicode=True)
526 self._assert_type_and_value(r2, self.ubody, obj)
527 r3 = _body_or_str(obj, unicode=False)
528 self._assert_type_and_value(r3, self.bbody, obj)
529 assert type(r1) is type(r2)
530 assert type(r1) is not type(r3) # type: ignore[comparison-overlap]
531
532 @staticmethod
533 def _assert_type_and_value(

Callers

nothing calls this directly

Calls 2

_body_or_strFunction · 0.90

Tested by

no test coverage detected