Skip to content

back to OpenHands summary

OpenHands: scrapy

Pytest Summary for test tests

status count
passed 400
failed 800
skipped 31
xfailed 2
total 1233
collected 1233

Failed pytests:

init.py::CmdlineCrawlPipelineTest::test_open_spider_normally_in_pipeline

__init__.py::CmdlineCrawlPipelineTest::test_open_spider_normally_in_pipeline
self = 

    def test_open_spider_normally_in_pipeline(self):
>       self.assertEqual(self._execute("normal"), 0)
E       AssertionError: 1 != 0

/testbed/tests/test_cmdline_crawl_with_pipeline/__init__.py:16: AssertionError

test_command_fetch.py::FetchTest::test_headers

test_command_fetch.py::FetchTest::test_headers
self = 

    @defer.inlineCallbacks
    def test_headers(self):
>       _, out, _ = yield self.execute([self.url("/text"), "--headers"])
E       AttributeError: 'FetchTest' object has no attribute 'execute'

/testbed/tests/test_command_fetch.py:32: AttributeError

test_command_fetch.py::FetchTest::test_output

test_command_fetch.py::FetchTest::test_output
self = 

    @defer.inlineCallbacks
    def test_output(self):
>       _, out, _ = yield self.execute([self.url("/text")])
E       AttributeError: 'FetchTest' object has no attribute 'execute'

/testbed/tests/test_command_fetch.py:13: AttributeError

test_command_fetch.py::FetchTest::test_redirect_default

test_command_fetch.py::FetchTest::test_redirect_default
self = 

    @defer.inlineCallbacks
    def test_redirect_default(self):
>       _, out, _ = yield self.execute([self.url("/redirect")])
E       AttributeError: 'FetchTest' object has no attribute 'execute'

/testbed/tests/test_command_fetch.py:18: AttributeError

test_command_fetch.py::FetchTest::test_redirect_disabled

test_command_fetch.py::FetchTest::test_redirect_disabled
self = 

    @defer.inlineCallbacks
    def test_redirect_disabled(self):
>       _, out, err = yield self.execute(
            ["--no-redirect", self.url("/redirect-no-meta-refresh")]
        )
E       AttributeError: 'FetchTest' object has no attribute 'execute'

/testbed/tests/test_command_fetch.py:23: AttributeError

test_command_shell.py::ShellTest::test_dns_failures

test_command_shell.py::ShellTest::test_dns_failures
self = 

    @defer.inlineCallbacks
    def test_dns_failures(self):
        if NON_EXISTING_RESOLVABLE:
            raise unittest.SkipTest("Non-existing hosts are resolvable")
        url = "www.somedomainthatdoesntexi.st"
>       errcode, out, err = yield self.execute([url, "-c", "item"], check_code=False)
E       AttributeError: 'ShellTest' object has no attribute 'execute'

/testbed/tests/test_command_shell.py:129: AttributeError

test_command_shell.py::ShellTest::test_empty

test_command_shell.py::ShellTest::test_empty
self = 

    @defer.inlineCallbacks
    def test_empty(self):
>       _, out, _ = yield self.execute(["-c", "item"])
E       AttributeError: 'ShellTest' object has no attribute 'execute'

/testbed/tests/test_command_shell.py:21: AttributeError

test_command_shell.py::ShellTest::test_fetch_redirect_follow_302

test_command_shell.py::ShellTest::test_fetch_redirect_follow_302
self = 

    @defer.inlineCallbacks
    def test_fetch_redirect_follow_302(self):
        """Test that calling ``fetch(url)`` follows HTTP redirects by default."""
>       url = self.url("/redirect-no-meta-refresh")
E       AttributeError: 'ShellTest' object has no attribute 'url'

/testbed/tests/test_command_shell.py:79: AttributeError

test_command_shell.py::ShellTest::test_fetch_redirect_not_follow_302

test_command_shell.py::ShellTest::test_fetch_redirect_not_follow_302
self = 

    @defer.inlineCallbacks
    def test_fetch_redirect_not_follow_302(self):
        """Test that calling ``fetch(url, redirect=False)`` disables automatic redirects."""
>       url = self.url("/redirect-no-meta-refresh")
E       AttributeError: 'ShellTest' object has no attribute 'url'

/testbed/tests/test_command_shell.py:89: AttributeError

test_command_shell.py::ShellTest::test_local_file

test_command_shell.py::ShellTest::test_local_file
self = 

    @defer.inlineCallbacks
    def test_local_file(self):
        filepath = Path(tests_datadir, "test_site", "index.html")
>       _, out, _ = yield self.execute([str(filepath), "-c", "item"])
E       AttributeError: 'ShellTest' object has no attribute 'execute'

/testbed/tests/test_command_shell.py:112: AttributeError

test_command_shell.py::ShellTest::test_local_nofile

test_command_shell.py::ShellTest::test_local_nofile
self = 

    @defer.inlineCallbacks
    def test_local_nofile(self):
        filepath = "file:///tests/sample_data/test_site/nothinghere.html"
>       errcode, out, err = yield self.execute(
            [filepath, "-c", "item"], check_code=False
        )
E       AttributeError: 'ShellTest' object has no attribute 'execute'

/testbed/tests/test_command_shell.py:118: AttributeError

test_command_shell.py::ShellTest::test_redirect

test_command_shell.py::ShellTest::test_redirect
self = 

    @defer.inlineCallbacks
    def test_redirect(self):
>       _, out, _ = yield self.execute([self.url("/redirect"), "-c", "response.url"])
E       AttributeError: 'ShellTest' object has no attribute 'execute'

/testbed/tests/test_command_shell.py:54: AttributeError

test_command_shell.py::ShellTest::test_redirect_follow_302

test_command_shell.py::ShellTest::test_redirect_follow_302
self = 

    @defer.inlineCallbacks
    def test_redirect_follow_302(self):
>       _, out, _ = yield self.execute(
            [self.url("/redirect-no-meta-refresh"), "-c", "response.status"]
        )
E       AttributeError: 'ShellTest' object has no attribute 'execute'

/testbed/tests/test_command_shell.py:59: AttributeError

test_command_shell.py::ShellTest::test_redirect_not_follow_302

test_command_shell.py::ShellTest::test_redirect_not_follow_302
self = 

    @defer.inlineCallbacks
    def test_redirect_not_follow_302(self):
>       _, out, _ = yield self.execute(
            [
                "--no-redirect",
                self.url("/redirect-no-meta-refresh"),
                "-c",
                "response.status",
            ]
        )
E       AttributeError: 'ShellTest' object has no attribute 'execute'

/testbed/tests/test_command_shell.py:66: AttributeError

test_command_shell.py::ShellTest::test_request_replace

test_command_shell.py::ShellTest::test_request_replace
self = 

    @defer.inlineCallbacks
    def test_request_replace(self):
>       url = self.url("/text")
E       AttributeError: 'ShellTest' object has no attribute 'url'

/testbed/tests/test_command_shell.py:97: AttributeError

test_command_shell.py::ShellTest::test_response_body

test_command_shell.py::ShellTest::test_response_body
self = 

    @defer.inlineCallbacks
    def test_response_body(self):
>       _, out, _ = yield self.execute([self.url("/text"), "-c", "response.body"])
E       AttributeError: 'ShellTest' object has no attribute 'execute'

/testbed/tests/test_command_shell.py:26: AttributeError

test_command_shell.py::ShellTest::test_response_encoding_gb18030

test_command_shell.py::ShellTest::test_response_encoding_gb18030
self = 

    @defer.inlineCallbacks
    def test_response_encoding_gb18030(self):
>       _, out, _ = yield self.execute(
            [self.url("/enc-gb18030"), "-c", "response.encoding"]
        )
E       AttributeError: 'ShellTest' object has no attribute 'execute'

/testbed/tests/test_command_shell.py:47: AttributeError

test_command_shell.py::ShellTest::test_response_selector_html

test_command_shell.py::ShellTest::test_response_selector_html
self = 

    @defer.inlineCallbacks
    def test_response_selector_html(self):
        xpath = "response.xpath(\"//p[@class='one']/text()\").get()"
>       _, out, _ = yield self.execute([self.url("/html"), "-c", xpath])
E       AttributeError: 'ShellTest' object has no attribute 'execute'

/testbed/tests/test_command_shell.py:42: AttributeError

test_command_shell.py::ShellTest::test_response_type_html

test_command_shell.py::ShellTest::test_response_type_html
self = 

    @defer.inlineCallbacks
    def test_response_type_html(self):
>       _, out, _ = yield self.execute([self.url("/html"), "-c", "type(response)"])
E       AttributeError: 'ShellTest' object has no attribute 'execute'

/testbed/tests/test_command_shell.py:36: AttributeError

test_command_shell.py::ShellTest::test_response_type_text

test_command_shell.py::ShellTest::test_response_type_text
self = 

    @defer.inlineCallbacks
    def test_response_type_text(self):
>       _, out, _ = yield self.execute([self.url("/text"), "-c", "type(response)"])
E       AttributeError: 'ShellTest' object has no attribute 'execute'

/testbed/tests/test_command_shell.py:31: AttributeError

test_command_shell.py::ShellTest::test_scrapy_import

test_command_shell.py::ShellTest::test_scrapy_import
self = 

    @defer.inlineCallbacks
    def test_scrapy_import(self):
>       url = self.url("/text")
E       AttributeError: 'ShellTest' object has no attribute 'url'

/testbed/tests/test_command_shell.py:104: AttributeError

test_command_shell.py::ShellTest::test_shell_fetch_async

test_command_shell.py::ShellTest::test_shell_fetch_async
self = 

    @defer.inlineCallbacks
    def test_shell_fetch_async(self):
        reactor_path = "twisted.internet.asyncioreactor.AsyncioSelectorReactor"
>       url = self.url("/html")
E       AttributeError: 'ShellTest' object has no attribute 'url'

/testbed/tests/test_command_shell.py:136: AttributeError

test_command_shell.py::InteractiveShellTest::test_fetch

test_command_shell.py::InteractiveShellTest::test_fetch
self = 

    def test_fetch(self):
        args = (
            sys.executable,
            "-m",
            "scrapy.cmdline",
            "shell",
        )
        env = os.environ.copy()
        env["SCRAPY_PYTHON_SHELL"] = "python"
        logfile = BytesIO()
        p = PopenSpawn(args, env=env, timeout=5)
        p.logfile_read = logfile
>       p.expect_exact("Available Scrapy objects")

/testbed/tests/test_command_shell.py:156: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/.venv/lib/python3.12/site-packages/pexpect/spawnbase.py:432: in expect_exact
    return exp.expect_loop(timeout)
/testbed/.venv/lib/python3.12/site-packages/pexpect/expect.py:179: in expect_loop
    return self.eof(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
err = EOF('End Of File (EOF).')

    def eof(self, err=None):
        spawn = self.spawn

        spawn.before = spawn._before.getvalue()
        spawn._buffer = spawn.buffer_type()
        spawn._before = spawn.buffer_type()
        spawn.after = EOF
        index = self.searcher.eof_index
        if index >= 0:
            spawn.match = EOF
            spawn.match_index = index
            return index
        else:
            spawn.match = None
            spawn.match_index = None
            msg = str(spawn)
            msg += '\nsearcher: %s' % self.searcher
            if err is not None:
                msg = str(err) + '\n' + msg

            exc = EOF(msg)
            exc.__cause__ = None # in Python 3.x we can use "raise exc from None"
>           raise exc
E           pexpect.exceptions.EOF: End Of File (EOF).
E           
E           searcher: searcher_string:
E               0: b'Available Scrapy objects'

/testbed/.venv/lib/python3.12/site-packages/pexpect/expect.py:122: EOF

test_command_version.py::VersionTest::test_output

test_command_version.py::VersionTest::test_output
self = 

    @defer.inlineCallbacks
    def test_output(self):
        encoding = getattr(sys.stdout, "encoding") or "utf-8"
>       _, out, _ = yield self.execute([])
E       AttributeError: 'VersionTest' object has no attribute 'execute'

/testbed/tests/test_command_version.py:16: AttributeError

test_command_version.py::VersionTest::test_verbose_output

test_command_version.py::VersionTest::test_verbose_output
self = 

    @defer.inlineCallbacks
    def test_verbose_output(self):
        encoding = getattr(sys.stdout, "encoding") or "utf-8"
>       _, out, _ = yield self.execute(["-v"])
E       AttributeError: 'VersionTest' object has no attribute 'execute'

/testbed/tests/test_command_version.py:25: AttributeError

test_downloadermiddleware_httpauth.py::HttpAuthMiddlewareLegacyTest::test_auth

test_downloadermiddleware_httpauth.py::HttpAuthMiddlewareLegacyTest::test_auth
self = 

    def test_auth(self):
        with pytest.warns(
            ScrapyDeprecationWarning,
            match="Using HttpAuthMiddleware without http_auth_domain is deprecated",
        ):
            mw = HttpAuthMiddleware()
>           mw.spider_opened(self.spider)
E           AttributeError: 'HttpAuthMiddleware' object has no attribute 'spider_opened'

/testbed/tests/test_downloadermiddleware_httpauth.py:39: AttributeError

During handling of the above exception, another exception occurred:

self = 

    def test_auth(self):
>       with pytest.warns(
            ScrapyDeprecationWarning,
            match="Using HttpAuthMiddleware without http_auth_domain is deprecated",
        ):
E       Failed: DID NOT WARN. No warnings of type (,) were emitted.
E        Emitted warnings: [].

/testbed/tests/test_downloadermiddleware_httpauth.py:34: Failed

test_downloadermiddleware_httpauth.py::HttpAuthMiddlewareLegacyTest::test_auth_already_set

test_downloadermiddleware_httpauth.py::HttpAuthMiddlewareLegacyTest::test_auth_already_set
self = 

    def test_auth_already_set(self):
        with pytest.warns(
            ScrapyDeprecationWarning,
            match="Using HttpAuthMiddleware without http_auth_domain is deprecated",
        ):
            mw = HttpAuthMiddleware()
>           mw.spider_opened(self.spider)
E           AttributeError: 'HttpAuthMiddleware' object has no attribute 'spider_opened'

/testbed/tests/test_downloadermiddleware_httpauth.py:62: AttributeError

During handling of the above exception, another exception occurred:

self = 

    def test_auth_already_set(self):
>       with pytest.warns(
            ScrapyDeprecationWarning,
            match="Using HttpAuthMiddleware without http_auth_domain is deprecated",
        ):
E       Failed: DID NOT WARN. No warnings of type (,) were emitted.
E        Emitted warnings: [].

/testbed/tests/test_downloadermiddleware_httpauth.py:57: Failed

test_downloadermiddleware_httpauth.py::HttpAuthMiddlewareTest::test_auth_already_set

test_downloadermiddleware_httpauth.py::HttpAuthMiddlewareTest::test_auth_already_set
self = 

    def setUp(self):
        self.mw = HttpAuthMiddleware()
        self.spider = TestSpider("foo")
>       self.mw.spider_opened(self.spider)
E       AttributeError: 'HttpAuthMiddleware' object has no attribute 'spider_opened'

/testbed/tests/test_downloadermiddleware_httpauth.py:72: AttributeError

test_downloadermiddleware_httpauth.py::HttpAuthMiddlewareTest::test_auth_domain

test_downloadermiddleware_httpauth.py::HttpAuthMiddlewareTest::test_auth_domain
self = 

    def setUp(self):
        self.mw = HttpAuthMiddleware()
        self.spider = TestSpider("foo")
>       self.mw.spider_opened(self.spider)
E       AttributeError: 'HttpAuthMiddleware' object has no attribute 'spider_opened'

/testbed/tests/test_downloadermiddleware_httpauth.py:72: AttributeError

test_downloadermiddleware_httpauth.py::HttpAuthMiddlewareTest::test_auth_subdomain

test_downloadermiddleware_httpauth.py::HttpAuthMiddlewareTest::test_auth_subdomain
self = 

    def setUp(self):
        self.mw = HttpAuthMiddleware()
        self.spider = TestSpider("foo")
>       self.mw.spider_opened(self.spider)
E       AttributeError: 'HttpAuthMiddleware' object has no attribute 'spider_opened'

/testbed/tests/test_downloadermiddleware_httpauth.py:72: AttributeError

test_downloadermiddleware_httpauth.py::HttpAuthMiddlewareTest::test_no_auth

test_downloadermiddleware_httpauth.py::HttpAuthMiddlewareTest::test_no_auth
self = 

    def setUp(self):
        self.mw = HttpAuthMiddleware()
        self.spider = TestSpider("foo")
>       self.mw.spider_opened(self.spider)
E       AttributeError: 'HttpAuthMiddleware' object has no attribute 'spider_opened'

/testbed/tests/test_downloadermiddleware_httpauth.py:72: AttributeError

test_downloadermiddleware_httpauth.py::HttpAuthAnyMiddlewareTest::test_auth

test_downloadermiddleware_httpauth.py::HttpAuthAnyMiddlewareTest::test_auth
self = 

    def setUp(self):
        self.mw = HttpAuthMiddleware()
        self.spider = TestSpiderAny("foo")
>       self.mw.spider_opened(self.spider)
E       AttributeError: 'HttpAuthMiddleware' object has no attribute 'spider_opened'

/testbed/tests/test_downloadermiddleware_httpauth.py:102: AttributeError

test_downloadermiddleware_httpauth.py::HttpAuthAnyMiddlewareTest::test_auth_already_set

test_downloadermiddleware_httpauth.py::HttpAuthAnyMiddlewareTest::test_auth_already_set
self = 

    def setUp(self):
        self.mw = HttpAuthMiddleware()
        self.spider = TestSpiderAny("foo")
>       self.mw.spider_opened(self.spider)
E       AttributeError: 'HttpAuthMiddleware' object has no attribute 'spider_opened'

/testbed/tests/test_downloadermiddleware_httpauth.py:102: AttributeError

test_exporters.py::BaseItemExporterTest::test_export_dict_item

test_exporters.py::BaseItemExporterTest::test_export_dict_item
self = 

    def test_export_dict_item(self):
>       self.assertItemExportWorks(ItemAdapter(self.i).asdict())

/testbed/tests/test_exporters.py:101: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
item = {'age': '22', 'name': 'John£'}

    def assertItemExportWorks(self, item):
>       self.ie.start_exporting()
E       AttributeError: 'BaseItemExporter' object has no attribute 'start_exporting'

/testbed/tests/test_exporters.py:84: AttributeError

test_exporters.py::BaseItemExporterTest::test_export_item

test_exporters.py::BaseItemExporterTest::test_export_item
self = 

    def test_export_item(self):
>       self.assertItemExportWorks(self.i)

/testbed/tests/test_exporters.py:98: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
item = {'age': '22', 'name': 'John£'}

    def assertItemExportWorks(self, item):
>       self.ie.start_exporting()
E       AttributeError: 'BaseItemExporter' object has no attribute 'start_exporting'

/testbed/tests/test_exporters.py:84: AttributeError

test_exporters.py::BaseItemExporterTest::test_field_custom_serializer

test_exporters.py::BaseItemExporterTest::test_field_custom_serializer
self = 

    def test_field_custom_serializer(self):
        i = self.custom_field_item_class(name="John\xa3", age="22")
        a = ItemAdapter(i)
        ie = self._get_exporter()
        self.assertEqual(
>           ie.serialize_field(a.get_field_meta("name"), "name", a["name"]), "John\xa3"
        )
E       AttributeError: 'BaseItemExporter' object has no attribute 'serialize_field'

/testbed/tests/test_exporters.py:130: AttributeError

test_exporters.py::BaseItemExporterTest::test_fields_to_export

test_exporters.py::BaseItemExporterTest::test_fields_to_export
self = 

    def test_fields_to_export(self):
        ie = self._get_exporter(fields_to_export=["name"])
        self.assertEqual(
>           list(ie._get_serialized_fields(self.i)), [("name", "John\xa3")]
        )
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_exporters.py:114: TypeError

test_exporters.py::BaseItemExporterTest::test_serialize_field

test_exporters.py::BaseItemExporterTest::test_serialize_field
self = 

    def test_serialize_field(self):
        a = ItemAdapter(self.i)
>       res = self.ie.serialize_field(a.get_field_meta("name"), "name", a["name"])
E       AttributeError: 'BaseItemExporter' object has no attribute 'serialize_field'

/testbed/tests/test_exporters.py:105: AttributeError

test_exporters.py::BaseItemExporterDataclassTest::test_export_dict_item

test_exporters.py::BaseItemExporterDataclassTest::test_export_dict_item
self = 

    def test_export_dict_item(self):
>       self.assertItemExportWorks(ItemAdapter(self.i).asdict())

/testbed/tests/test_exporters.py:101: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
item = {'age': '22', 'name': 'John£'}

    def assertItemExportWorks(self, item):
>       self.ie.start_exporting()
E       AttributeError: 'BaseItemExporter' object has no attribute 'start_exporting'

/testbed/tests/test_exporters.py:84: AttributeError

test_exporters.py::BaseItemExporterDataclassTest::test_export_item

test_exporters.py::BaseItemExporterDataclassTest::test_export_item
self = 

    def test_export_item(self):
>       self.assertItemExportWorks(self.i)

/testbed/tests/test_exporters.py:98: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
item = TestDataClass(name='John£', age='22')

    def assertItemExportWorks(self, item):
>       self.ie.start_exporting()
E       AttributeError: 'BaseItemExporter' object has no attribute 'start_exporting'

/testbed/tests/test_exporters.py:84: AttributeError

test_exporters.py::BaseItemExporterDataclassTest::test_field_custom_serializer

test_exporters.py::BaseItemExporterDataclassTest::test_field_custom_serializer
self = 

    def test_field_custom_serializer(self):
        i = self.custom_field_item_class(name="John\xa3", age="22")
        a = ItemAdapter(i)
        ie = self._get_exporter()
        self.assertEqual(
>           ie.serialize_field(a.get_field_meta("name"), "name", a["name"]), "John\xa3"
        )
E       AttributeError: 'BaseItemExporter' object has no attribute 'serialize_field'

/testbed/tests/test_exporters.py:130: AttributeError

test_exporters.py::BaseItemExporterDataclassTest::test_fields_to_export

test_exporters.py::BaseItemExporterDataclassTest::test_fields_to_export
self = 

    def test_fields_to_export(self):
        ie = self._get_exporter(fields_to_export=["name"])
        self.assertEqual(
>           list(ie._get_serialized_fields(self.i)), [("name", "John\xa3")]
        )
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_exporters.py:114: TypeError

test_exporters.py::BaseItemExporterDataclassTest::test_serialize_field

test_exporters.py::BaseItemExporterDataclassTest::test_serialize_field
self = 

    def test_serialize_field(self):
        a = ItemAdapter(self.i)
>       res = self.ie.serialize_field(a.get_field_meta("name"), "name", a["name"])
E       AttributeError: 'BaseItemExporter' object has no attribute 'serialize_field'

/testbed/tests/test_exporters.py:105: AttributeError

test_exporters.py::PythonItemExporterTest::test_export_dict_item

test_exporters.py::PythonItemExporterTest::test_export_dict_item
self = 

    def test_export_dict_item(self):
>       self.assertItemExportWorks(ItemAdapter(self.i).asdict())

/testbed/tests/test_exporters.py:101: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
item = {'age': '22', 'name': 'John£'}

    def assertItemExportWorks(self, item):
>       self.ie.start_exporting()
E       AttributeError: 'PythonItemExporter' object has no attribute 'start_exporting'

/testbed/tests/test_exporters.py:84: AttributeError

test_exporters.py::PythonItemExporterTest::test_export_item

test_exporters.py::PythonItemExporterTest::test_export_item
self = 

    def test_export_item(self):
>       self.assertItemExportWorks(self.i)

/testbed/tests/test_exporters.py:98: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
item = {'age': '22', 'name': 'John£'}

    def assertItemExportWorks(self, item):
>       self.ie.start_exporting()
E       AttributeError: 'PythonItemExporter' object has no attribute 'start_exporting'

/testbed/tests/test_exporters.py:84: AttributeError

test_exporters.py::PythonItemExporterTest::test_export_item_dict_list

test_exporters.py::PythonItemExporterTest::test_export_item_dict_list
self = 

    def test_export_item_dict_list(self):
        i1 = self.item_class(name="Joseph", age="22")
        i2 = dict(name="Maria", age=[i1])
        i3 = self.item_class(name="Jesus", age=[i2])
        ie = self._get_exporter()
>       exported = ie.export_item(i3)
E       AttributeError: 'PythonItemExporter' object has no attribute 'export_item'

/testbed/tests/test_exporters.py:188: AttributeError

test_exporters.py::PythonItemExporterTest::test_export_list

test_exporters.py::PythonItemExporterTest::test_export_list
self = 

    def test_export_list(self):
        i1 = self.item_class(name="Joseph", age="22")
        i2 = self.item_class(name="Maria", age=[i1])
        i3 = self.item_class(name="Jesus", age=[i2])
        ie = self._get_exporter()
>       exported = ie.export_item(i3)
E       AttributeError: 'PythonItemExporter' object has no attribute 'export_item'

/testbed/tests/test_exporters.py:172: AttributeError

test_exporters.py::PythonItemExporterTest::test_field_custom_serializer

test_exporters.py::PythonItemExporterTest::test_field_custom_serializer
self = 

    def test_field_custom_serializer(self):
        i = self.custom_field_item_class(name="John\xa3", age="22")
        a = ItemAdapter(i)
        ie = self._get_exporter()
        self.assertEqual(
>           ie.serialize_field(a.get_field_meta("name"), "name", a["name"]), "John\xa3"
        )
E       AttributeError: 'PythonItemExporter' object has no attribute 'serialize_field'

/testbed/tests/test_exporters.py:130: AttributeError

test_exporters.py::PythonItemExporterTest::test_fields_to_export

test_exporters.py::PythonItemExporterTest::test_fields_to_export
self = 

    def test_fields_to_export(self):
        ie = self._get_exporter(fields_to_export=["name"])
        self.assertEqual(
>           list(ie._get_serialized_fields(self.i)), [("name", "John\xa3")]
        )
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_exporters.py:114: TypeError

test_exporters.py::PythonItemExporterTest::test_invalid_option

test_exporters.py::PythonItemExporterTest::test_invalid_option
self = 

    def test_invalid_option(self):
>       with self.assertRaisesRegex(TypeError, "Unexpected options: invalid_option"):
E       AssertionError: TypeError not raised

/testbed/tests/test_exporters.py:147: AssertionError

test_exporters.py::PythonItemExporterTest::test_nested_item

test_exporters.py::PythonItemExporterTest::test_nested_item
self = 

    def test_nested_item(self):
        i1 = self.item_class(name="Joseph", age="22")
        i2 = dict(name="Maria", age=i1)
        i3 = self.item_class(name="Jesus", age=i2)
        ie = self._get_exporter()
>       exported = ie.export_item(i3)
E       AttributeError: 'PythonItemExporter' object has no attribute 'export_item'

/testbed/tests/test_exporters.py:155: AttributeError

test_exporters.py::PythonItemExporterTest::test_nonstring_types_item

test_exporters.py::PythonItemExporterTest::test_nonstring_types_item
self = 

    def test_nonstring_types_item(self):
        item = self._get_nonstring_types_item()
        ie = self._get_exporter()
>       exported = ie.export_item(item)
E       AttributeError: 'PythonItemExporter' object has no attribute 'export_item'

/testbed/tests/test_exporters.py:202: AttributeError

test_exporters.py::PythonItemExporterTest::test_serialize_field

test_exporters.py::PythonItemExporterTest::test_serialize_field
self = 

    def test_serialize_field(self):
        a = ItemAdapter(self.i)
>       res = self.ie.serialize_field(a.get_field_meta("name"), "name", a["name"])
E       AttributeError: 'PythonItemExporter' object has no attribute 'serialize_field'

/testbed/tests/test_exporters.py:105: AttributeError

test_exporters.py::PythonItemExporterDataclassTest::test_export_dict_item

test_exporters.py::PythonItemExporterDataclassTest::test_export_dict_item
self = 

    def test_export_dict_item(self):
>       self.assertItemExportWorks(ItemAdapter(self.i).asdict())

/testbed/tests/test_exporters.py:101: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
item = {'age': '22', 'name': 'John£'}

    def assertItemExportWorks(self, item):
>       self.ie.start_exporting()
E       AttributeError: 'PythonItemExporter' object has no attribute 'start_exporting'

/testbed/tests/test_exporters.py:84: AttributeError

test_exporters.py::PythonItemExporterDataclassTest::test_export_item

test_exporters.py::PythonItemExporterDataclassTest::test_export_item
self = 

    def test_export_item(self):
>       self.assertItemExportWorks(self.i)

/testbed/tests/test_exporters.py:98: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
item = TestDataClass(name='John£', age='22')

    def assertItemExportWorks(self, item):
>       self.ie.start_exporting()
E       AttributeError: 'PythonItemExporter' object has no attribute 'start_exporting'

/testbed/tests/test_exporters.py:84: AttributeError

test_exporters.py::PythonItemExporterDataclassTest::test_export_item_dict_list

test_exporters.py::PythonItemExporterDataclassTest::test_export_item_dict_list
self = 

    def test_export_item_dict_list(self):
        i1 = self.item_class(name="Joseph", age="22")
        i2 = dict(name="Maria", age=[i1])
        i3 = self.item_class(name="Jesus", age=[i2])
        ie = self._get_exporter()
>       exported = ie.export_item(i3)
E       AttributeError: 'PythonItemExporter' object has no attribute 'export_item'

/testbed/tests/test_exporters.py:188: AttributeError

test_exporters.py::PythonItemExporterDataclassTest::test_export_list

test_exporters.py::PythonItemExporterDataclassTest::test_export_list
self = 

    def test_export_list(self):
        i1 = self.item_class(name="Joseph", age="22")
        i2 = self.item_class(name="Maria", age=[i1])
        i3 = self.item_class(name="Jesus", age=[i2])
        ie = self._get_exporter()
>       exported = ie.export_item(i3)
E       AttributeError: 'PythonItemExporter' object has no attribute 'export_item'

/testbed/tests/test_exporters.py:172: AttributeError

test_exporters.py::PythonItemExporterDataclassTest::test_field_custom_serializer

test_exporters.py::PythonItemExporterDataclassTest::test_field_custom_serializer
self = 

    def test_field_custom_serializer(self):
        i = self.custom_field_item_class(name="John\xa3", age="22")
        a = ItemAdapter(i)
        ie = self._get_exporter()
        self.assertEqual(
>           ie.serialize_field(a.get_field_meta("name"), "name", a["name"]), "John\xa3"
        )
E       AttributeError: 'PythonItemExporter' object has no attribute 'serialize_field'

/testbed/tests/test_exporters.py:130: AttributeError

test_exporters.py::PythonItemExporterDataclassTest::test_fields_to_export

test_exporters.py::PythonItemExporterDataclassTest::test_fields_to_export
self = 

    def test_fields_to_export(self):
        ie = self._get_exporter(fields_to_export=["name"])
        self.assertEqual(
>           list(ie._get_serialized_fields(self.i)), [("name", "John\xa3")]
        )
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_exporters.py:114: TypeError

test_exporters.py::PythonItemExporterDataclassTest::test_invalid_option

test_exporters.py::PythonItemExporterDataclassTest::test_invalid_option
self = 

    def test_invalid_option(self):
>       with self.assertRaisesRegex(TypeError, "Unexpected options: invalid_option"):
E       AssertionError: TypeError not raised

/testbed/tests/test_exporters.py:147: AssertionError

test_exporters.py::PythonItemExporterDataclassTest::test_nested_item

test_exporters.py::PythonItemExporterDataclassTest::test_nested_item
self = 

    def test_nested_item(self):
        i1 = self.item_class(name="Joseph", age="22")
        i2 = dict(name="Maria", age=i1)
        i3 = self.item_class(name="Jesus", age=i2)
        ie = self._get_exporter()
>       exported = ie.export_item(i3)
E       AttributeError: 'PythonItemExporter' object has no attribute 'export_item'

/testbed/tests/test_exporters.py:155: AttributeError

test_exporters.py::PythonItemExporterDataclassTest::test_nonstring_types_item

test_exporters.py::PythonItemExporterDataclassTest::test_nonstring_types_item
self = 

    def test_nonstring_types_item(self):
        item = self._get_nonstring_types_item()
        ie = self._get_exporter()
>       exported = ie.export_item(item)
E       AttributeError: 'PythonItemExporter' object has no attribute 'export_item'

/testbed/tests/test_exporters.py:202: AttributeError

test_exporters.py::PythonItemExporterDataclassTest::test_serialize_field

test_exporters.py::PythonItemExporterDataclassTest::test_serialize_field
self = 

    def test_serialize_field(self):
        a = ItemAdapter(self.i)
>       res = self.ie.serialize_field(a.get_field_meta("name"), "name", a["name"])
E       AttributeError: 'PythonItemExporter' object has no attribute 'serialize_field'

/testbed/tests/test_exporters.py:105: AttributeError

test_exporters.py::PprintItemExporterTest::test_export_dict_item

test_exporters.py::PprintItemExporterTest::test_export_dict_item
self = 

    def test_export_dict_item(self):
>       self.assertItemExportWorks(ItemAdapter(self.i).asdict())

/testbed/tests/test_exporters.py:101: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
item = {'age': '22', 'name': 'John£'}

    def assertItemExportWorks(self, item):
>       self.ie.start_exporting()
E       AttributeError: 'PprintItemExporter' object has no attribute 'start_exporting'

/testbed/tests/test_exporters.py:84: AttributeError

test_exporters.py::PprintItemExporterTest::test_export_item

test_exporters.py::PprintItemExporterTest::test_export_item
self = 

    def test_export_item(self):
>       self.assertItemExportWorks(self.i)

/testbed/tests/test_exporters.py:98: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
item = {'age': '22', 'name': 'John£'}

    def assertItemExportWorks(self, item):
>       self.ie.start_exporting()
E       AttributeError: 'PprintItemExporter' object has no attribute 'start_exporting'

/testbed/tests/test_exporters.py:84: AttributeError

test_exporters.py::PprintItemExporterTest::test_field_custom_serializer

test_exporters.py::PprintItemExporterTest::test_field_custom_serializer
self = 

    def test_field_custom_serializer(self):
        i = self.custom_field_item_class(name="John\xa3", age="22")
        a = ItemAdapter(i)
        ie = self._get_exporter()
        self.assertEqual(
>           ie.serialize_field(a.get_field_meta("name"), "name", a["name"]), "John\xa3"
        )
E       AttributeError: 'PprintItemExporter' object has no attribute 'serialize_field'

/testbed/tests/test_exporters.py:130: AttributeError

test_exporters.py::PprintItemExporterTest::test_fields_to_export

test_exporters.py::PprintItemExporterTest::test_fields_to_export
self = 

    def test_fields_to_export(self):
        ie = self._get_exporter(fields_to_export=["name"])
        self.assertEqual(
>           list(ie._get_serialized_fields(self.i)), [("name", "John\xa3")]
        )
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_exporters.py:114: TypeError

test_exporters.py::PprintItemExporterTest::test_serialize_field

test_exporters.py::PprintItemExporterTest::test_serialize_field
self = 

    def test_serialize_field(self):
        a = ItemAdapter(self.i)
>       res = self.ie.serialize_field(a.get_field_meta("name"), "name", a["name"])
E       AttributeError: 'PprintItemExporter' object has no attribute 'serialize_field'

/testbed/tests/test_exporters.py:105: AttributeError

test_exporters.py::PprintItemExporterDataclassTest::test_export_dict_item

test_exporters.py::PprintItemExporterDataclassTest::test_export_dict_item
self = 

    def test_export_dict_item(self):
>       self.assertItemExportWorks(ItemAdapter(self.i).asdict())

/testbed/tests/test_exporters.py:101: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
item = {'age': '22', 'name': 'John£'}

    def assertItemExportWorks(self, item):
>       self.ie.start_exporting()
E       AttributeError: 'PprintItemExporter' object has no attribute 'start_exporting'

/testbed/tests/test_exporters.py:84: AttributeError

test_exporters.py::PprintItemExporterDataclassTest::test_export_item

test_exporters.py::PprintItemExporterDataclassTest::test_export_item
self = 

    def test_export_item(self):
>       self.assertItemExportWorks(self.i)

/testbed/tests/test_exporters.py:98: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
item = TestDataClass(name='John£', age='22')

    def assertItemExportWorks(self, item):
>       self.ie.start_exporting()
E       AttributeError: 'PprintItemExporter' object has no attribute 'start_exporting'

/testbed/tests/test_exporters.py:84: AttributeError

test_exporters.py::PprintItemExporterDataclassTest::test_field_custom_serializer

test_exporters.py::PprintItemExporterDataclassTest::test_field_custom_serializer
self = 

    def test_field_custom_serializer(self):
        i = self.custom_field_item_class(name="John\xa3", age="22")
        a = ItemAdapter(i)
        ie = self._get_exporter()
        self.assertEqual(
>           ie.serialize_field(a.get_field_meta("name"), "name", a["name"]), "John\xa3"
        )
E       AttributeError: 'PprintItemExporter' object has no attribute 'serialize_field'

/testbed/tests/test_exporters.py:130: AttributeError

test_exporters.py::PprintItemExporterDataclassTest::test_fields_to_export

test_exporters.py::PprintItemExporterDataclassTest::test_fields_to_export
self = 

    def test_fields_to_export(self):
        ie = self._get_exporter(fields_to_export=["name"])
        self.assertEqual(
>           list(ie._get_serialized_fields(self.i)), [("name", "John\xa3")]
        )
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_exporters.py:114: TypeError

test_exporters.py::PprintItemExporterDataclassTest::test_serialize_field

test_exporters.py::PprintItemExporterDataclassTest::test_serialize_field
self = 

    def test_serialize_field(self):
        a = ItemAdapter(self.i)
>       res = self.ie.serialize_field(a.get_field_meta("name"), "name", a["name"])
E       AttributeError: 'PprintItemExporter' object has no attribute 'serialize_field'

/testbed/tests/test_exporters.py:105: AttributeError

test_exporters.py::PickleItemExporterTest::test_export_dict_item

test_exporters.py::PickleItemExporterTest::test_export_dict_item
self = 

    def test_export_dict_item(self):
>       self.assertItemExportWorks(ItemAdapter(self.i).asdict())

/testbed/tests/test_exporters.py:101: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
item = {'age': '22', 'name': 'John£'}

    def assertItemExportWorks(self, item):
>       self.ie.start_exporting()
E       AttributeError: 'PickleItemExporter' object has no attribute 'start_exporting'

/testbed/tests/test_exporters.py:84: AttributeError

test_exporters.py::PickleItemExporterTest::test_export_item

test_exporters.py::PickleItemExporterTest::test_export_item
self = 

    def test_export_item(self):
>       self.assertItemExportWorks(self.i)

/testbed/tests/test_exporters.py:98: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
item = {'age': '22', 'name': 'John£'}

    def assertItemExportWorks(self, item):
>       self.ie.start_exporting()
E       AttributeError: 'PickleItemExporter' object has no attribute 'start_exporting'

/testbed/tests/test_exporters.py:84: AttributeError

test_exporters.py::PickleItemExporterTest::test_export_multiple_items

test_exporters.py::PickleItemExporterTest::test_export_multiple_items
self = 

    def test_export_multiple_items(self):
        i1 = self.item_class(name="hello", age="world")
        i2 = self.item_class(name="bye", age="world")
        f = BytesIO()
        ie = PickleItemExporter(f)
>       ie.start_exporting()
E       AttributeError: 'PickleItemExporter' object has no attribute 'start_exporting'

/testbed/tests/test_exporters.py:236: AttributeError

test_exporters.py::PickleItemExporterTest::test_field_custom_serializer

test_exporters.py::PickleItemExporterTest::test_field_custom_serializer
self = 

    def test_field_custom_serializer(self):
        i = self.custom_field_item_class(name="John\xa3", age="22")
        a = ItemAdapter(i)
        ie = self._get_exporter()
        self.assertEqual(
>           ie.serialize_field(a.get_field_meta("name"), "name", a["name"]), "John\xa3"
        )
E       AttributeError: 'PickleItemExporter' object has no attribute 'serialize_field'

/testbed/tests/test_exporters.py:130: AttributeError

test_exporters.py::PickleItemExporterTest::test_fields_to_export

test_exporters.py::PickleItemExporterTest::test_fields_to_export
self = 

    def test_fields_to_export(self):
        ie = self._get_exporter(fields_to_export=["name"])
        self.assertEqual(
>           list(ie._get_serialized_fields(self.i)), [("name", "John\xa3")]
        )
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_exporters.py:114: TypeError

test_exporters.py::PickleItemExporterTest::test_nonstring_types_item

test_exporters.py::PickleItemExporterTest::test_nonstring_types_item
self = 

    def test_nonstring_types_item(self):
        item = self._get_nonstring_types_item()
        fp = BytesIO()
        ie = PickleItemExporter(fp)
>       ie.start_exporting()
E       AttributeError: 'PickleItemExporter' object has no attribute 'start_exporting'

/testbed/tests/test_exporters.py:249: AttributeError

test_exporters.py::PickleItemExporterTest::test_serialize_field

test_exporters.py::PickleItemExporterTest::test_serialize_field
self = 

    def test_serialize_field(self):
        a = ItemAdapter(self.i)
>       res = self.ie.serialize_field(a.get_field_meta("name"), "name", a["name"])
E       AttributeError: 'PickleItemExporter' object has no attribute 'serialize_field'

/testbed/tests/test_exporters.py:105: AttributeError

test_exporters.py::PickleItemExporterDataclassTest::test_export_dict_item

test_exporters.py::PickleItemExporterDataclassTest::test_export_dict_item
self = 

    def test_export_dict_item(self):
>       self.assertItemExportWorks(ItemAdapter(self.i).asdict())

/testbed/tests/test_exporters.py:101: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
item = {'age': '22', 'name': 'John£'}

    def assertItemExportWorks(self, item):
>       self.ie.start_exporting()
E       AttributeError: 'PickleItemExporter' object has no attribute 'start_exporting'

/testbed/tests/test_exporters.py:84: AttributeError

test_exporters.py::PickleItemExporterDataclassTest::test_export_item

test_exporters.py::PickleItemExporterDataclassTest::test_export_item
self = 

    def test_export_item(self):
>       self.assertItemExportWorks(self.i)

/testbed/tests/test_exporters.py:98: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
item = TestDataClass(name='John£', age='22')

    def assertItemExportWorks(self, item):
>       self.ie.start_exporting()
E       AttributeError: 'PickleItemExporter' object has no attribute 'start_exporting'

/testbed/tests/test_exporters.py:84: AttributeError

test_exporters.py::PickleItemExporterDataclassTest::test_export_multiple_items

test_exporters.py::PickleItemExporterDataclassTest::test_export_multiple_items
self = 

    def test_export_multiple_items(self):
        i1 = self.item_class(name="hello", age="world")
        i2 = self.item_class(name="bye", age="world")
        f = BytesIO()
        ie = PickleItemExporter(f)
>       ie.start_exporting()
E       AttributeError: 'PickleItemExporter' object has no attribute 'start_exporting'

/testbed/tests/test_exporters.py:236: AttributeError

test_exporters.py::PickleItemExporterDataclassTest::test_field_custom_serializer

test_exporters.py::PickleItemExporterDataclassTest::test_field_custom_serializer
self = 

    def test_field_custom_serializer(self):
        i = self.custom_field_item_class(name="John\xa3", age="22")
        a = ItemAdapter(i)
        ie = self._get_exporter()
        self.assertEqual(
>           ie.serialize_field(a.get_field_meta("name"), "name", a["name"]), "John\xa3"
        )
E       AttributeError: 'PickleItemExporter' object has no attribute 'serialize_field'

/testbed/tests/test_exporters.py:130: AttributeError

test_exporters.py::PickleItemExporterDataclassTest::test_fields_to_export

test_exporters.py::PickleItemExporterDataclassTest::test_fields_to_export
self = 

    def test_fields_to_export(self):
        ie = self._get_exporter(fields_to_export=["name"])
        self.assertEqual(
>           list(ie._get_serialized_fields(self.i)), [("name", "John\xa3")]
        )
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_exporters.py:114: TypeError

test_exporters.py::PickleItemExporterDataclassTest::test_nonstring_types_item

test_exporters.py::PickleItemExporterDataclassTest::test_nonstring_types_item
self = 

    def test_nonstring_types_item(self):
        item = self._get_nonstring_types_item()
        fp = BytesIO()
        ie = PickleItemExporter(fp)
>       ie.start_exporting()
E       AttributeError: 'PickleItemExporter' object has no attribute 'start_exporting'

/testbed/tests/test_exporters.py:249: AttributeError

test_exporters.py::PickleItemExporterDataclassTest::test_serialize_field

test_exporters.py::PickleItemExporterDataclassTest::test_serialize_field
self = 

    def test_serialize_field(self):
        a = ItemAdapter(self.i)
>       res = self.ie.serialize_field(a.get_field_meta("name"), "name", a["name"])
E       AttributeError: 'PickleItemExporter' object has no attribute 'serialize_field'

/testbed/tests/test_exporters.py:105: AttributeError

test_exporters.py::MarshalItemExporterTest::test_export_dict_item

test_exporters.py::MarshalItemExporterTest::test_export_dict_item
self = 

    def test_export_dict_item(self):
>       self.assertItemExportWorks(ItemAdapter(self.i).asdict())

/testbed/tests/test_exporters.py:101: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
item = {'age': '22', 'name': 'John£'}

    def assertItemExportWorks(self, item):
>       self.ie.start_exporting()
E       AttributeError: 'MarshalItemExporter' object has no attribute 'start_exporting'

/testbed/tests/test_exporters.py:84: AttributeError

test_exporters.py::MarshalItemExporterTest::test_export_item

test_exporters.py::MarshalItemExporterTest::test_export_item
self = 

    def test_export_item(self):
>       self.assertItemExportWorks(self.i)

/testbed/tests/test_exporters.py:98: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
item = {'age': '22', 'name': 'John£'}

    def assertItemExportWorks(self, item):
>       self.ie.start_exporting()
E       AttributeError: 'MarshalItemExporter' object has no attribute 'start_exporting'

/testbed/tests/test_exporters.py:84: AttributeError

test_exporters.py::MarshalItemExporterTest::test_field_custom_serializer

test_exporters.py::MarshalItemExporterTest::test_field_custom_serializer
self = 

    def test_field_custom_serializer(self):
        i = self.custom_field_item_class(name="John\xa3", age="22")
        a = ItemAdapter(i)
        ie = self._get_exporter()
        self.assertEqual(
>           ie.serialize_field(a.get_field_meta("name"), "name", a["name"]), "John\xa3"
        )
E       AttributeError: 'MarshalItemExporter' object has no attribute 'serialize_field'

/testbed/tests/test_exporters.py:130: AttributeError

test_exporters.py::MarshalItemExporterTest::test_fields_to_export

test_exporters.py::MarshalItemExporterTest::test_fields_to_export
self = 

    def test_fields_to_export(self):
        ie = self._get_exporter(fields_to_export=["name"])
        self.assertEqual(
>           list(ie._get_serialized_fields(self.i)), [("name", "John\xa3")]
        )
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_exporters.py:114: TypeError

test_exporters.py::MarshalItemExporterTest::test_nonstring_types_item

test_exporters.py::MarshalItemExporterTest::test_nonstring_types_item
self = 

    def test_nonstring_types_item(self):
        item = self._get_nonstring_types_item()
        item.pop("time")  # datetime is not marshallable
        fp = tempfile.TemporaryFile()
        ie = MarshalItemExporter(fp)
>       ie.start_exporting()
E       AttributeError: 'MarshalItemExporter' object has no attribute 'start_exporting'

/testbed/tests/test_exporters.py:275: AttributeError

test_exporters.py::MarshalItemExporterTest::test_serialize_field

test_exporters.py::MarshalItemExporterTest::test_serialize_field
self = 

    def test_serialize_field(self):
        a = ItemAdapter(self.i)
>       res = self.ie.serialize_field(a.get_field_meta("name"), "name", a["name"])
E       AttributeError: 'MarshalItemExporter' object has no attribute 'serialize_field'

/testbed/tests/test_exporters.py:105: AttributeError

test_exporters.py::MarshalItemExporterDataclassTest::test_export_dict_item

test_exporters.py::MarshalItemExporterDataclassTest::test_export_dict_item
self = 

    def test_export_dict_item(self):
>       self.assertItemExportWorks(ItemAdapter(self.i).asdict())

/testbed/tests/test_exporters.py:101: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
item = {'age': '22', 'name': 'John£'}

    def assertItemExportWorks(self, item):
>       self.ie.start_exporting()
E       AttributeError: 'MarshalItemExporter' object has no attribute 'start_exporting'

/testbed/tests/test_exporters.py:84: AttributeError

test_exporters.py::MarshalItemExporterDataclassTest::test_export_item

test_exporters.py::MarshalItemExporterDataclassTest::test_export_item
self = 

    def test_export_item(self):
>       self.assertItemExportWorks(self.i)

/testbed/tests/test_exporters.py:98: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
item = TestDataClass(name='John£', age='22')

    def assertItemExportWorks(self, item):
>       self.ie.start_exporting()
E       AttributeError: 'MarshalItemExporter' object has no attribute 'start_exporting'

/testbed/tests/test_exporters.py:84: AttributeError

test_exporters.py::MarshalItemExporterDataclassTest::test_field_custom_serializer

test_exporters.py::MarshalItemExporterDataclassTest::test_field_custom_serializer
self = 

    def test_field_custom_serializer(self):
        i = self.custom_field_item_class(name="John\xa3", age="22")
        a = ItemAdapter(i)
        ie = self._get_exporter()
        self.assertEqual(
>           ie.serialize_field(a.get_field_meta("name"), "name", a["name"]), "John\xa3"
        )
E       AttributeError: 'MarshalItemExporter' object has no attribute 'serialize_field'

/testbed/tests/test_exporters.py:130: AttributeError

test_exporters.py::MarshalItemExporterDataclassTest::test_fields_to_export

test_exporters.py::MarshalItemExporterDataclassTest::test_fields_to_export
self = 

    def test_fields_to_export(self):
        ie = self._get_exporter(fields_to_export=["name"])
        self.assertEqual(
>           list(ie._get_serialized_fields(self.i)), [("name", "John\xa3")]
        )
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_exporters.py:114: TypeError

test_exporters.py::MarshalItemExporterDataclassTest::test_nonstring_types_item

test_exporters.py::MarshalItemExporterDataclassTest::test_nonstring_types_item
self = 

    def test_nonstring_types_item(self):
        item = self._get_nonstring_types_item()
        item.pop("time")  # datetime is not marshallable
        fp = tempfile.TemporaryFile()
        ie = MarshalItemExporter(fp)
>       ie.start_exporting()
E       AttributeError: 'MarshalItemExporter' object has no attribute 'start_exporting'

/testbed/tests/test_exporters.py:275: AttributeError

test_exporters.py::MarshalItemExporterDataclassTest::test_serialize_field

test_exporters.py::MarshalItemExporterDataclassTest::test_serialize_field
self = 

    def test_serialize_field(self):
        a = ItemAdapter(self.i)
>       res = self.ie.serialize_field(a.get_field_meta("name"), "name", a["name"])
E       AttributeError: 'MarshalItemExporter' object has no attribute 'serialize_field'

/testbed/tests/test_exporters.py:105: AttributeError

test_exporters.py::CsvItemExporterTest::test_errors_default

test_exporters.py::CsvItemExporterTest::test_errors_default
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:291: in _get_exporter
    return CsvItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BufferedRandom name=16>, include_headers_line = True
join_multivalued = ',', errors = None, kwargs = {}

    def __init__(self, file, include_headers_line=True, join_multivalued=',', errors=None, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
>       if not self.encoding:
E       AttributeError: 'CsvItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:69: AttributeError

test_exporters.py::CsvItemExporterTest::test_errors_xmlcharrefreplace

test_exporters.py::CsvItemExporterTest::test_errors_xmlcharrefreplace
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:291: in _get_exporter
    return CsvItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BufferedRandom name=17>, include_headers_line = True
join_multivalued = ',', errors = None, kwargs = {}

    def __init__(self, file, include_headers_line=True, join_multivalued=',', errors=None, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
>       if not self.encoding:
E       AttributeError: 'CsvItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:69: AttributeError

test_exporters.py::CsvItemExporterTest::test_export_dict_item

test_exporters.py::CsvItemExporterTest::test_export_dict_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:291: in _get_exporter
    return CsvItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BufferedRandom name=18>, include_headers_line = True
join_multivalued = ',', errors = None, kwargs = {}

    def __init__(self, file, include_headers_line=True, join_multivalued=',', errors=None, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
>       if not self.encoding:
E       AttributeError: 'CsvItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:69: AttributeError

test_exporters.py::CsvItemExporterTest::test_export_item

test_exporters.py::CsvItemExporterTest::test_export_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:291: in _get_exporter
    return CsvItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BufferedRandom name=19>, include_headers_line = True
join_multivalued = ',', errors = None, kwargs = {}

    def __init__(self, file, include_headers_line=True, join_multivalued=',', errors=None, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
>       if not self.encoding:
E       AttributeError: 'CsvItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:69: AttributeError

test_exporters.py::CsvItemExporterTest::test_field_custom_serializer

test_exporters.py::CsvItemExporterTest::test_field_custom_serializer
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:291: in _get_exporter
    return CsvItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BufferedRandom name=20>, include_headers_line = True
join_multivalued = ',', errors = None, kwargs = {}

    def __init__(self, file, include_headers_line=True, join_multivalued=',', errors=None, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
>       if not self.encoding:
E       AttributeError: 'CsvItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:69: AttributeError

test_exporters.py::CsvItemExporterTest::test_fields_to_export

test_exporters.py::CsvItemExporterTest::test_fields_to_export
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:291: in _get_exporter
    return CsvItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BufferedRandom name=21>, include_headers_line = True
join_multivalued = ',', errors = None, kwargs = {}

    def __init__(self, file, include_headers_line=True, join_multivalued=',', errors=None, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
>       if not self.encoding:
E       AttributeError: 'CsvItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:69: AttributeError

test_exporters.py::CsvItemExporterTest::test_header_export_all

test_exporters.py::CsvItemExporterTest::test_header_export_all
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:291: in _get_exporter
    return CsvItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BufferedRandom name=15>, include_headers_line = True
join_multivalued = ',', errors = None, kwargs = {}

    def __init__(self, file, include_headers_line=True, join_multivalued=',', errors=None, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
>       if not self.encoding:
E       AttributeError: 'CsvItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:69: AttributeError

test_exporters.py::CsvItemExporterTest::test_header_export_all_dict

test_exporters.py::CsvItemExporterTest::test_header_export_all_dict
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:291: in _get_exporter
    return CsvItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BufferedRandom name=16>, include_headers_line = True
join_multivalued = ',', errors = None, kwargs = {}

    def __init__(self, file, include_headers_line=True, join_multivalued=',', errors=None, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
>       if not self.encoding:
E       AttributeError: 'CsvItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:69: AttributeError

test_exporters.py::CsvItemExporterTest::test_header_export_single_field

test_exporters.py::CsvItemExporterTest::test_header_export_single_field
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:291: in _get_exporter
    return CsvItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BufferedRandom name=17>, include_headers_line = True
join_multivalued = ',', errors = None, kwargs = {}

    def __init__(self, file, include_headers_line=True, join_multivalued=',', errors=None, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
>       if not self.encoding:
E       AttributeError: 'CsvItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:69: AttributeError

test_exporters.py::CsvItemExporterTest::test_header_export_two_items

test_exporters.py::CsvItemExporterTest::test_header_export_two_items
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:291: in _get_exporter
    return CsvItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BufferedRandom name=18>, include_headers_line = True
join_multivalued = ',', errors = None, kwargs = {}

    def __init__(self, file, include_headers_line=True, join_multivalued=',', errors=None, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
>       if not self.encoding:
E       AttributeError: 'CsvItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:69: AttributeError

test_exporters.py::CsvItemExporterTest::test_header_no_header_line

test_exporters.py::CsvItemExporterTest::test_header_no_header_line
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:291: in _get_exporter
    return CsvItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BufferedRandom name=19>, include_headers_line = True
join_multivalued = ',', errors = None, kwargs = {}

    def __init__(self, file, include_headers_line=True, join_multivalued=',', errors=None, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
>       if not self.encoding:
E       AttributeError: 'CsvItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:69: AttributeError

test_exporters.py::CsvItemExporterTest::test_join_multivalue

test_exporters.py::CsvItemExporterTest::test_join_multivalue
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:291: in _get_exporter
    return CsvItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BufferedRandom name=20>, include_headers_line = True
join_multivalued = ',', errors = None, kwargs = {}

    def __init__(self, file, include_headers_line=True, join_multivalued=',', errors=None, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
>       if not self.encoding:
E       AttributeError: 'CsvItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:69: AttributeError

test_exporters.py::CsvItemExporterTest::test_join_multivalue_not_strings

test_exporters.py::CsvItemExporterTest::test_join_multivalue_not_strings
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:291: in _get_exporter
    return CsvItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BufferedRandom name=15>, include_headers_line = True
join_multivalued = ',', errors = None, kwargs = {}

    def __init__(self, file, include_headers_line=True, join_multivalued=',', errors=None, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
>       if not self.encoding:
E       AttributeError: 'CsvItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:69: AttributeError

test_exporters.py::CsvItemExporterTest::test_nonstring_types_item

test_exporters.py::CsvItemExporterTest::test_nonstring_types_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:291: in _get_exporter
    return CsvItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BufferedRandom name=16>, include_headers_line = True
join_multivalued = ',', errors = None, kwargs = {}

    def __init__(self, file, include_headers_line=True, join_multivalued=',', errors=None, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
>       if not self.encoding:
E       AttributeError: 'CsvItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:69: AttributeError

test_exporters.py::CsvItemExporterTest::test_serialize_field

test_exporters.py::CsvItemExporterTest::test_serialize_field
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:291: in _get_exporter
    return CsvItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BufferedRandom name=17>, include_headers_line = True
join_multivalued = ',', errors = None, kwargs = {}

    def __init__(self, file, include_headers_line=True, join_multivalued=',', errors=None, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
>       if not self.encoding:
E       AttributeError: 'CsvItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:69: AttributeError

test_exporters.py::CsvItemExporterDataclassTest::test_errors_default

test_exporters.py::CsvItemExporterDataclassTest::test_errors_default
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:291: in _get_exporter
    return CsvItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BufferedRandom name=18>, include_headers_line = True
join_multivalued = ',', errors = None, kwargs = {}

    def __init__(self, file, include_headers_line=True, join_multivalued=',', errors=None, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
>       if not self.encoding:
E       AttributeError: 'CsvItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:69: AttributeError

test_exporters.py::CsvItemExporterDataclassTest::test_errors_xmlcharrefreplace

test_exporters.py::CsvItemExporterDataclassTest::test_errors_xmlcharrefreplace
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:291: in _get_exporter
    return CsvItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BufferedRandom name=19>, include_headers_line = True
join_multivalued = ',', errors = None, kwargs = {}

    def __init__(self, file, include_headers_line=True, join_multivalued=',', errors=None, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
>       if not self.encoding:
E       AttributeError: 'CsvItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:69: AttributeError

test_exporters.py::CsvItemExporterDataclassTest::test_export_dict_item

test_exporters.py::CsvItemExporterDataclassTest::test_export_dict_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:291: in _get_exporter
    return CsvItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BufferedRandom name=22>, include_headers_line = True
join_multivalued = ',', errors = None, kwargs = {}

    def __init__(self, file, include_headers_line=True, join_multivalued=',', errors=None, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
>       if not self.encoding:
E       AttributeError: 'CsvItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:69: AttributeError

test_exporters.py::CsvItemExporterDataclassTest::test_export_item

test_exporters.py::CsvItemExporterDataclassTest::test_export_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:291: in _get_exporter
    return CsvItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BufferedRandom name=15>, include_headers_line = True
join_multivalued = ',', errors = None, kwargs = {}

    def __init__(self, file, include_headers_line=True, join_multivalued=',', errors=None, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
>       if not self.encoding:
E       AttributeError: 'CsvItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:69: AttributeError

test_exporters.py::CsvItemExporterDataclassTest::test_field_custom_serializer

test_exporters.py::CsvItemExporterDataclassTest::test_field_custom_serializer
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:291: in _get_exporter
    return CsvItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BufferedRandom name=16>, include_headers_line = True
join_multivalued = ',', errors = None, kwargs = {}

    def __init__(self, file, include_headers_line=True, join_multivalued=',', errors=None, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
>       if not self.encoding:
E       AttributeError: 'CsvItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:69: AttributeError

test_exporters.py::CsvItemExporterDataclassTest::test_fields_to_export

test_exporters.py::CsvItemExporterDataclassTest::test_fields_to_export
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:291: in _get_exporter
    return CsvItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BufferedRandom name=17>, include_headers_line = True
join_multivalued = ',', errors = None, kwargs = {}

    def __init__(self, file, include_headers_line=True, join_multivalued=',', errors=None, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
>       if not self.encoding:
E       AttributeError: 'CsvItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:69: AttributeError

test_exporters.py::CsvItemExporterDataclassTest::test_header_export_all

test_exporters.py::CsvItemExporterDataclassTest::test_header_export_all
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:291: in _get_exporter
    return CsvItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BufferedRandom name=18>, include_headers_line = True
join_multivalued = ',', errors = None, kwargs = {}

    def __init__(self, file, include_headers_line=True, join_multivalued=',', errors=None, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
>       if not self.encoding:
E       AttributeError: 'CsvItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:69: AttributeError

test_exporters.py::CsvItemExporterDataclassTest::test_header_export_all_dict

test_exporters.py::CsvItemExporterDataclassTest::test_header_export_all_dict
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:291: in _get_exporter
    return CsvItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BufferedRandom name=19>, include_headers_line = True
join_multivalued = ',', errors = None, kwargs = {}

    def __init__(self, file, include_headers_line=True, join_multivalued=',', errors=None, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
>       if not self.encoding:
E       AttributeError: 'CsvItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:69: AttributeError

test_exporters.py::CsvItemExporterDataclassTest::test_header_export_single_field

test_exporters.py::CsvItemExporterDataclassTest::test_header_export_single_field
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:291: in _get_exporter
    return CsvItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BufferedRandom name=23>, include_headers_line = True
join_multivalued = ',', errors = None, kwargs = {}

    def __init__(self, file, include_headers_line=True, join_multivalued=',', errors=None, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
>       if not self.encoding:
E       AttributeError: 'CsvItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:69: AttributeError

test_exporters.py::CsvItemExporterDataclassTest::test_header_export_two_items

test_exporters.py::CsvItemExporterDataclassTest::test_header_export_two_items
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:291: in _get_exporter
    return CsvItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BufferedRandom name=15>, include_headers_line = True
join_multivalued = ',', errors = None, kwargs = {}

    def __init__(self, file, include_headers_line=True, join_multivalued=',', errors=None, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
>       if not self.encoding:
E       AttributeError: 'CsvItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:69: AttributeError

test_exporters.py::CsvItemExporterDataclassTest::test_header_no_header_line

test_exporters.py::CsvItemExporterDataclassTest::test_header_no_header_line
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:291: in _get_exporter
    return CsvItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BufferedRandom name=16>, include_headers_line = True
join_multivalued = ',', errors = None, kwargs = {}

    def __init__(self, file, include_headers_line=True, join_multivalued=',', errors=None, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
>       if not self.encoding:
E       AttributeError: 'CsvItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:69: AttributeError

test_exporters.py::CsvItemExporterDataclassTest::test_join_multivalue

test_exporters.py::CsvItemExporterDataclassTest::test_join_multivalue
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:291: in _get_exporter
    return CsvItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BufferedRandom name=17>, include_headers_line = True
join_multivalued = ',', errors = None, kwargs = {}

    def __init__(self, file, include_headers_line=True, join_multivalued=',', errors=None, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
>       if not self.encoding:
E       AttributeError: 'CsvItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:69: AttributeError

test_exporters.py::CsvItemExporterDataclassTest::test_join_multivalue_not_strings

test_exporters.py::CsvItemExporterDataclassTest::test_join_multivalue_not_strings
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:291: in _get_exporter
    return CsvItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BufferedRandom name=18>, include_headers_line = True
join_multivalued = ',', errors = None, kwargs = {}

    def __init__(self, file, include_headers_line=True, join_multivalued=',', errors=None, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
>       if not self.encoding:
E       AttributeError: 'CsvItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:69: AttributeError

test_exporters.py::CsvItemExporterDataclassTest::test_nonstring_types_item

test_exporters.py::CsvItemExporterDataclassTest::test_nonstring_types_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:291: in _get_exporter
    return CsvItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BufferedRandom name=19>, include_headers_line = True
join_multivalued = ',', errors = None, kwargs = {}

    def __init__(self, file, include_headers_line=True, join_multivalued=',', errors=None, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
>       if not self.encoding:
E       AttributeError: 'CsvItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:69: AttributeError

test_exporters.py::CsvItemExporterDataclassTest::test_serialize_field

test_exporters.py::CsvItemExporterDataclassTest::test_serialize_field
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:291: in _get_exporter
    return CsvItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BufferedRandom name=24>, include_headers_line = True
join_multivalued = ',', errors = None, kwargs = {}

    def __init__(self, file, include_headers_line=True, join_multivalued=',', errors=None, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
>       if not self.encoding:
E       AttributeError: 'CsvItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:69: AttributeError

test_exporters.py::XmlItemExporterTest::test_export_dict_item

test_exporters.py::XmlItemExporterTest::test_export_dict_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:410: in _get_exporter
    return XmlItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb973e7920>, kwargs = {}

    def __init__(self, file, **kwargs):
        self.item_element = kwargs.pop('item_element', 'item')
        self.root_element = kwargs.pop('root_element', 'items')
        super().__init__(**kwargs)
>       if not self.encoding:
E       AttributeError: 'XmlItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:61: AttributeError

test_exporters.py::XmlItemExporterTest::test_export_item

test_exporters.py::XmlItemExporterTest::test_export_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:410: in _get_exporter
    return XmlItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96ca5300>, kwargs = {}

    def __init__(self, file, **kwargs):
        self.item_element = kwargs.pop('item_element', 'item')
        self.root_element = kwargs.pop('root_element', 'items')
        super().__init__(**kwargs)
>       if not self.encoding:
E       AttributeError: 'XmlItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:61: AttributeError

test_exporters.py::XmlItemExporterTest::test_field_custom_serializer

test_exporters.py::XmlItemExporterTest::test_field_custom_serializer
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:410: in _get_exporter
    return XmlItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96ca6980>, kwargs = {}

    def __init__(self, file, **kwargs):
        self.item_element = kwargs.pop('item_element', 'item')
        self.root_element = kwargs.pop('root_element', 'items')
        super().__init__(**kwargs)
>       if not self.encoding:
E       AttributeError: 'XmlItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:61: AttributeError

test_exporters.py::XmlItemExporterTest::test_fields_to_export

test_exporters.py::XmlItemExporterTest::test_fields_to_export
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:410: in _get_exporter
    return XmlItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96ca7740>, kwargs = {}

    def __init__(self, file, **kwargs):
        self.item_element = kwargs.pop('item_element', 'item')
        self.root_element = kwargs.pop('root_element', 'items')
        super().__init__(**kwargs)
>       if not self.encoding:
E       AttributeError: 'XmlItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:61: AttributeError

test_exporters.py::XmlItemExporterTest::test_multivalued_fields

test_exporters.py::XmlItemExporterTest::test_multivalued_fields
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:410: in _get_exporter
    return XmlItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96ca5a80>, kwargs = {}

    def __init__(self, file, **kwargs):
        self.item_element = kwargs.pop('item_element', 'item')
        self.root_element = kwargs.pop('root_element', 'items')
        super().__init__(**kwargs)
>       if not self.encoding:
E       AttributeError: 'XmlItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:61: AttributeError

test_exporters.py::XmlItemExporterTest::test_nested_item

test_exporters.py::XmlItemExporterTest::test_nested_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:410: in _get_exporter
    return XmlItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96ca4630>, kwargs = {}

    def __init__(self, file, **kwargs):
        self.item_element = kwargs.pop('item_element', 'item')
        self.root_element = kwargs.pop('root_element', 'items')
        super().__init__(**kwargs)
>       if not self.encoding:
E       AttributeError: 'XmlItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:61: AttributeError

test_exporters.py::XmlItemExporterTest::test_nested_list_item

test_exporters.py::XmlItemExporterTest::test_nested_list_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:410: in _get_exporter
    return XmlItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96f62840>, kwargs = {}

    def __init__(self, file, **kwargs):
        self.item_element = kwargs.pop('item_element', 'item')
        self.root_element = kwargs.pop('root_element', 'items')
        super().__init__(**kwargs)
>       if not self.encoding:
E       AttributeError: 'XmlItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:61: AttributeError

test_exporters.py::XmlItemExporterTest::test_nonstring_types_item

test_exporters.py::XmlItemExporterTest::test_nonstring_types_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:410: in _get_exporter
    return XmlItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96dbd760>, kwargs = {}

    def __init__(self, file, **kwargs):
        self.item_element = kwargs.pop('item_element', 'item')
        self.root_element = kwargs.pop('root_element', 'items')
        super().__init__(**kwargs)
>       if not self.encoding:
E       AttributeError: 'XmlItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:61: AttributeError

test_exporters.py::XmlItemExporterTest::test_serialize_field

test_exporters.py::XmlItemExporterTest::test_serialize_field
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:410: in _get_exporter
    return XmlItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96dbd1c0>, kwargs = {}

    def __init__(self, file, **kwargs):
        self.item_element = kwargs.pop('item_element', 'item')
        self.root_element = kwargs.pop('root_element', 'items')
        super().__init__(**kwargs)
>       if not self.encoding:
E       AttributeError: 'XmlItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:61: AttributeError

test_exporters.py::XmlItemExporterDataclassTest::test_export_dict_item

test_exporters.py::XmlItemExporterDataclassTest::test_export_dict_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:410: in _get_exporter
    return XmlItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96dbc590>, kwargs = {}

    def __init__(self, file, **kwargs):
        self.item_element = kwargs.pop('item_element', 'item')
        self.root_element = kwargs.pop('root_element', 'items')
        super().__init__(**kwargs)
>       if not self.encoding:
E       AttributeError: 'XmlItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:61: AttributeError

test_exporters.py::XmlItemExporterDataclassTest::test_export_item

test_exporters.py::XmlItemExporterDataclassTest::test_export_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:410: in _get_exporter
    return XmlItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96ca7060>, kwargs = {}

    def __init__(self, file, **kwargs):
        self.item_element = kwargs.pop('item_element', 'item')
        self.root_element = kwargs.pop('root_element', 'items')
        super().__init__(**kwargs)
>       if not self.encoding:
E       AttributeError: 'XmlItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:61: AttributeError

test_exporters.py::XmlItemExporterDataclassTest::test_field_custom_serializer

test_exporters.py::XmlItemExporterDataclassTest::test_field_custom_serializer
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:410: in _get_exporter
    return XmlItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96ca4f40>, kwargs = {}

    def __init__(self, file, **kwargs):
        self.item_element = kwargs.pop('item_element', 'item')
        self.root_element = kwargs.pop('root_element', 'items')
        super().__init__(**kwargs)
>       if not self.encoding:
E       AttributeError: 'XmlItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:61: AttributeError

test_exporters.py::XmlItemExporterDataclassTest::test_fields_to_export

test_exporters.py::XmlItemExporterDataclassTest::test_fields_to_export
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:410: in _get_exporter
    return XmlItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96ca7330>, kwargs = {}

    def __init__(self, file, **kwargs):
        self.item_element = kwargs.pop('item_element', 'item')
        self.root_element = kwargs.pop('root_element', 'items')
        super().__init__(**kwargs)
>       if not self.encoding:
E       AttributeError: 'XmlItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:61: AttributeError

test_exporters.py::XmlItemExporterDataclassTest::test_multivalued_fields

test_exporters.py::XmlItemExporterDataclassTest::test_multivalued_fields
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:410: in _get_exporter
    return XmlItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96ca7bf0>, kwargs = {}

    def __init__(self, file, **kwargs):
        self.item_element = kwargs.pop('item_element', 'item')
        self.root_element = kwargs.pop('root_element', 'items')
        super().__init__(**kwargs)
>       if not self.encoding:
E       AttributeError: 'XmlItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:61: AttributeError

test_exporters.py::XmlItemExporterDataclassTest::test_nested_item

test_exporters.py::XmlItemExporterDataclassTest::test_nested_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:410: in _get_exporter
    return XmlItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96ca5cb0>, kwargs = {}

    def __init__(self, file, **kwargs):
        self.item_element = kwargs.pop('item_element', 'item')
        self.root_element = kwargs.pop('root_element', 'items')
        super().__init__(**kwargs)
>       if not self.encoding:
E       AttributeError: 'XmlItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:61: AttributeError

test_exporters.py::XmlItemExporterDataclassTest::test_nested_list_item

test_exporters.py::XmlItemExporterDataclassTest::test_nested_list_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:410: in _get_exporter
    return XmlItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96dbccc0>, kwargs = {}

    def __init__(self, file, **kwargs):
        self.item_element = kwargs.pop('item_element', 'item')
        self.root_element = kwargs.pop('root_element', 'items')
        super().__init__(**kwargs)
>       if not self.encoding:
E       AttributeError: 'XmlItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:61: AttributeError

test_exporters.py::XmlItemExporterDataclassTest::test_nonstring_types_item

test_exporters.py::XmlItemExporterDataclassTest::test_nonstring_types_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:410: in _get_exporter
    return XmlItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c2e4d0>, kwargs = {}

    def __init__(self, file, **kwargs):
        self.item_element = kwargs.pop('item_element', 'item')
        self.root_element = kwargs.pop('root_element', 'items')
        super().__init__(**kwargs)
>       if not self.encoding:
E       AttributeError: 'XmlItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:61: AttributeError

test_exporters.py::XmlItemExporterDataclassTest::test_serialize_field

test_exporters.py::XmlItemExporterDataclassTest::test_serialize_field
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:410: in _get_exporter
    return XmlItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c2eb60>, kwargs = {}

    def __init__(self, file, **kwargs):
        self.item_element = kwargs.pop('item_element', 'item')
        self.root_element = kwargs.pop('root_element', 'items')
        super().__init__(**kwargs)
>       if not self.encoding:
E       AttributeError: 'XmlItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:61: AttributeError

test_exporters.py::JsonLinesItemExporterTest::test_export_dict_item

test_exporters.py::JsonLinesItemExporterTest::test_export_dict_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:526: in _get_exporter
    return JsonLinesItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96f62bb0>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       self._kwargs.setdefault('ensure_ascii', not self.encoding)
E       AttributeError: 'JsonLinesItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:41: AttributeError

test_exporters.py::JsonLinesItemExporterTest::test_export_item

test_exporters.py::JsonLinesItemExporterTest::test_export_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:526: in _get_exporter
    return JsonLinesItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c2ebb0>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       self._kwargs.setdefault('ensure_ascii', not self.encoding)
E       AttributeError: 'JsonLinesItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:41: AttributeError

test_exporters.py::JsonLinesItemExporterTest::test_extra_keywords

test_exporters.py::JsonLinesItemExporterTest::test_extra_keywords
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:526: in _get_exporter
    return JsonLinesItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c2f650>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       self._kwargs.setdefault('ensure_ascii', not self.encoding)
E       AttributeError: 'JsonLinesItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:41: AttributeError

test_exporters.py::JsonLinesItemExporterTest::test_field_custom_serializer

test_exporters.py::JsonLinesItemExporterTest::test_field_custom_serializer
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:526: in _get_exporter
    return JsonLinesItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c2f4c0>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       self._kwargs.setdefault('ensure_ascii', not self.encoding)
E       AttributeError: 'JsonLinesItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:41: AttributeError

test_exporters.py::JsonLinesItemExporterTest::test_fields_to_export

test_exporters.py::JsonLinesItemExporterTest::test_fields_to_export
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:526: in _get_exporter
    return JsonLinesItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c2f920>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       self._kwargs.setdefault('ensure_ascii', not self.encoding)
E       AttributeError: 'JsonLinesItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:41: AttributeError

test_exporters.py::JsonLinesItemExporterTest::test_nested_item

test_exporters.py::JsonLinesItemExporterTest::test_nested_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:526: in _get_exporter
    return JsonLinesItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c2c040>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       self._kwargs.setdefault('ensure_ascii', not self.encoding)
E       AttributeError: 'JsonLinesItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:41: AttributeError

test_exporters.py::JsonLinesItemExporterTest::test_nonstring_types_item

test_exporters.py::JsonLinesItemExporterTest::test_nonstring_types_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:526: in _get_exporter
    return JsonLinesItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c2c270>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       self._kwargs.setdefault('ensure_ascii', not self.encoding)
E       AttributeError: 'JsonLinesItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:41: AttributeError

test_exporters.py::JsonLinesItemExporterTest::test_serialize_field

test_exporters.py::JsonLinesItemExporterTest::test_serialize_field
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:526: in _get_exporter
    return JsonLinesItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c2c810>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       self._kwargs.setdefault('ensure_ascii', not self.encoding)
E       AttributeError: 'JsonLinesItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:41: AttributeError

test_exporters.py::JsonLinesItemExporterDataclassTest::test_export_dict_item

test_exporters.py::JsonLinesItemExporterDataclassTest::test_export_dict_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:526: in _get_exporter
    return JsonLinesItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c2f9c0>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       self._kwargs.setdefault('ensure_ascii', not self.encoding)
E       AttributeError: 'JsonLinesItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:41: AttributeError

test_exporters.py::JsonLinesItemExporterDataclassTest::test_export_item

test_exporters.py::JsonLinesItemExporterDataclassTest::test_export_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:526: in _get_exporter
    return JsonLinesItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c2cae0>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       self._kwargs.setdefault('ensure_ascii', not self.encoding)
E       AttributeError: 'JsonLinesItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:41: AttributeError

test_exporters.py::JsonLinesItemExporterDataclassTest::test_extra_keywords

test_exporters.py::JsonLinesItemExporterDataclassTest::test_extra_keywords
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:526: in _get_exporter
    return JsonLinesItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c2cea0>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       self._kwargs.setdefault('ensure_ascii', not self.encoding)
E       AttributeError: 'JsonLinesItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:41: AttributeError

test_exporters.py::JsonLinesItemExporterDataclassTest::test_field_custom_serializer

test_exporters.py::JsonLinesItemExporterDataclassTest::test_field_custom_serializer
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:526: in _get_exporter
    return JsonLinesItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c2dad0>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       self._kwargs.setdefault('ensure_ascii', not self.encoding)
E       AttributeError: 'JsonLinesItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:41: AttributeError

test_exporters.py::JsonLinesItemExporterDataclassTest::test_fields_to_export

test_exporters.py::JsonLinesItemExporterDataclassTest::test_fields_to_export
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:526: in _get_exporter
    return JsonLinesItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c2d760>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       self._kwargs.setdefault('ensure_ascii', not self.encoding)
E       AttributeError: 'JsonLinesItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:41: AttributeError

test_exporters.py::JsonLinesItemExporterDataclassTest::test_nested_item

test_exporters.py::JsonLinesItemExporterDataclassTest::test_nested_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:526: in _get_exporter
    return JsonLinesItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c2dda0>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       self._kwargs.setdefault('ensure_ascii', not self.encoding)
E       AttributeError: 'JsonLinesItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:41: AttributeError

test_exporters.py::JsonLinesItemExporterDataclassTest::test_nonstring_types_item

test_exporters.py::JsonLinesItemExporterDataclassTest::test_nonstring_types_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:526: in _get_exporter
    return JsonLinesItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c2e0c0>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       self._kwargs.setdefault('ensure_ascii', not self.encoding)
E       AttributeError: 'JsonLinesItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:41: AttributeError

test_exporters.py::JsonLinesItemExporterDataclassTest::test_serialize_field

test_exporters.py::JsonLinesItemExporterDataclassTest::test_serialize_field
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:526: in _get_exporter
    return JsonLinesItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c2f1a0>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       self._kwargs.setdefault('ensure_ascii', not self.encoding)
E       AttributeError: 'JsonLinesItemExporter' object has no attribute 'encoding'

/testbed/scrapy/exporters.py:41: AttributeError

test_exporters.py::JsonItemExporterTest::test_export_dict_item

test_exporters.py::JsonItemExporterTest::test_export_dict_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:569: in _get_exporter
    return JsonItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c2e5c0>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       json_indent = self.indent if self.indent is not None and self.indent > 0 else None
E       AttributeError: 'JsonItemExporter' object has no attribute 'indent'

/testbed/scrapy/exporters.py:49: AttributeError

test_exporters.py::JsonItemExporterTest::test_export_item

test_exporters.py::JsonItemExporterTest::test_export_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:569: in _get_exporter
    return JsonItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb973e7100>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       json_indent = self.indent if self.indent is not None and self.indent > 0 else None
E       AttributeError: 'JsonItemExporter' object has no attribute 'indent'

/testbed/scrapy/exporters.py:49: AttributeError

test_exporters.py::JsonItemExporterTest::test_extra_keywords

test_exporters.py::JsonItemExporterTest::test_extra_keywords
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:569: in _get_exporter
    return JsonItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96ca46d0>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       json_indent = self.indent if self.indent is not None and self.indent > 0 else None
E       AttributeError: 'JsonItemExporter' object has no attribute 'indent'

/testbed/scrapy/exporters.py:49: AttributeError

test_exporters.py::JsonItemExporterTest::test_field_custom_serializer

test_exporters.py::JsonItemExporterTest::test_field_custom_serializer
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:569: in _get_exporter
    return JsonItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c2dda0>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       json_indent = self.indent if self.indent is not None and self.indent > 0 else None
E       AttributeError: 'JsonItemExporter' object has no attribute 'indent'

/testbed/scrapy/exporters.py:49: AttributeError

test_exporters.py::JsonItemExporterTest::test_fields_to_export

test_exporters.py::JsonItemExporterTest::test_fields_to_export
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:569: in _get_exporter
    return JsonItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c2d7b0>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       json_indent = self.indent if self.indent is not None and self.indent > 0 else None
E       AttributeError: 'JsonItemExporter' object has no attribute 'indent'

/testbed/scrapy/exporters.py:49: AttributeError

test_exporters.py::JsonItemExporterTest::test_nested_dict_item

test_exporters.py::JsonItemExporterTest::test_nested_dict_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:569: in _get_exporter
    return JsonItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c94360>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       json_indent = self.indent if self.indent is not None and self.indent > 0 else None
E       AttributeError: 'JsonItemExporter' object has no attribute 'indent'

/testbed/scrapy/exporters.py:49: AttributeError

test_exporters.py::JsonItemExporterTest::test_nested_item

test_exporters.py::JsonItemExporterTest::test_nested_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:569: in _get_exporter
    return JsonItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c94770>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       json_indent = self.indent if self.indent is not None and self.indent > 0 else None
E       AttributeError: 'JsonItemExporter' object has no attribute 'indent'

/testbed/scrapy/exporters.py:49: AttributeError

test_exporters.py::JsonItemExporterTest::test_nonstring_types_item

test_exporters.py::JsonItemExporterTest::test_nonstring_types_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:569: in _get_exporter
    return JsonItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c94d10>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       json_indent = self.indent if self.indent is not None and self.indent > 0 else None
E       AttributeError: 'JsonItemExporter' object has no attribute 'indent'

/testbed/scrapy/exporters.py:49: AttributeError

test_exporters.py::JsonItemExporterTest::test_serialize_field

test_exporters.py::JsonItemExporterTest::test_serialize_field
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:569: in _get_exporter
    return JsonItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c94c20>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       json_indent = self.indent if self.indent is not None and self.indent > 0 else None
E       AttributeError: 'JsonItemExporter' object has no attribute 'indent'

/testbed/scrapy/exporters.py:49: AttributeError

test_exporters.py::JsonItemExporterTest::test_two_dict_items

test_exporters.py::JsonItemExporterTest::test_two_dict_items
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:569: in _get_exporter
    return JsonItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c95210>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       json_indent = self.indent if self.indent is not None and self.indent > 0 else None
E       AttributeError: 'JsonItemExporter' object has no attribute 'indent'

/testbed/scrapy/exporters.py:49: AttributeError

test_exporters.py::JsonItemExporterTest::test_two_items

test_exporters.py::JsonItemExporterTest::test_two_items
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:569: in _get_exporter
    return JsonItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c95530>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       json_indent = self.indent if self.indent is not None and self.indent > 0 else None
E       AttributeError: 'JsonItemExporter' object has no attribute 'indent'

/testbed/scrapy/exporters.py:49: AttributeError

test_exporters.py::JsonItemExporterTest::test_two_items_with_failure_between

test_exporters.py::JsonItemExporterTest::test_two_items_with_failure_between
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:569: in _get_exporter
    return JsonItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c95ad0>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       json_indent = self.indent if self.indent is not None and self.indent > 0 else None
E       AttributeError: 'JsonItemExporter' object has no attribute 'indent'

/testbed/scrapy/exporters.py:49: AttributeError

test_exporters.py::JsonItemExporterToBytesTest::test_export_dict_item

test_exporters.py::JsonItemExporterToBytesTest::test_export_dict_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:647: in _get_exporter
    return JsonItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96ca6f70>, kwargs = {'encoding': 'latin'}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       json_indent = self.indent if self.indent is not None and self.indent > 0 else None
E       AttributeError: 'JsonItemExporter' object has no attribute 'indent'

/testbed/scrapy/exporters.py:49: AttributeError

test_exporters.py::JsonItemExporterToBytesTest::test_export_item

test_exporters.py::JsonItemExporterToBytesTest::test_export_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:647: in _get_exporter
    return JsonItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c94130>, kwargs = {'encoding': 'latin'}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       json_indent = self.indent if self.indent is not None and self.indent > 0 else None
E       AttributeError: 'JsonItemExporter' object has no attribute 'indent'

/testbed/scrapy/exporters.py:49: AttributeError

test_exporters.py::JsonItemExporterToBytesTest::test_field_custom_serializer

test_exporters.py::JsonItemExporterToBytesTest::test_field_custom_serializer
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:647: in _get_exporter
    return JsonItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c95bc0>, kwargs = {'encoding': 'latin'}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       json_indent = self.indent if self.indent is not None and self.indent > 0 else None
E       AttributeError: 'JsonItemExporter' object has no attribute 'indent'

/testbed/scrapy/exporters.py:49: AttributeError

test_exporters.py::JsonItemExporterToBytesTest::test_fields_to_export

test_exporters.py::JsonItemExporterToBytesTest::test_fields_to_export
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:647: in _get_exporter
    return JsonItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c95fd0>, kwargs = {'encoding': 'latin'}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       json_indent = self.indent if self.indent is not None and self.indent > 0 else None
E       AttributeError: 'JsonItemExporter' object has no attribute 'indent'

/testbed/scrapy/exporters.py:49: AttributeError

test_exporters.py::JsonItemExporterToBytesTest::test_serialize_field

test_exporters.py::JsonItemExporterToBytesTest::test_serialize_field
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:647: in _get_exporter
    return JsonItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c95580>, kwargs = {'encoding': 'latin'}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       json_indent = self.indent if self.indent is not None and self.indent > 0 else None
E       AttributeError: 'JsonItemExporter' object has no attribute 'indent'

/testbed/scrapy/exporters.py:49: AttributeError

test_exporters.py::JsonItemExporterToBytesTest::test_two_items_with_failure_between

test_exporters.py::JsonItemExporterToBytesTest::test_two_items_with_failure_between
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:647: in _get_exporter
    return JsonItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c96a20>, kwargs = {'encoding': 'latin'}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       json_indent = self.indent if self.indent is not None and self.indent > 0 else None
E       AttributeError: 'JsonItemExporter' object has no attribute 'indent'

/testbed/scrapy/exporters.py:49: AttributeError

test_exporters.py::JsonItemExporterDataclassTest::test_export_dict_item

test_exporters.py::JsonItemExporterDataclassTest::test_export_dict_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:569: in _get_exporter
    return JsonItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96dbccc0>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       json_indent = self.indent if self.indent is not None and self.indent > 0 else None
E       AttributeError: 'JsonItemExporter' object has no attribute 'indent'

/testbed/scrapy/exporters.py:49: AttributeError

test_exporters.py::JsonItemExporterDataclassTest::test_export_item

test_exporters.py::JsonItemExporterDataclassTest::test_export_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:569: in _get_exporter
    return JsonItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c96930>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       json_indent = self.indent if self.indent is not None and self.indent > 0 else None
E       AttributeError: 'JsonItemExporter' object has no attribute 'indent'

/testbed/scrapy/exporters.py:49: AttributeError

test_exporters.py::JsonItemExporterDataclassTest::test_extra_keywords

test_exporters.py::JsonItemExporterDataclassTest::test_extra_keywords
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:569: in _get_exporter
    return JsonItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c97920>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       json_indent = self.indent if self.indent is not None and self.indent > 0 else None
E       AttributeError: 'JsonItemExporter' object has no attribute 'indent'

/testbed/scrapy/exporters.py:49: AttributeError

test_exporters.py::JsonItemExporterDataclassTest::test_field_custom_serializer

test_exporters.py::JsonItemExporterDataclassTest::test_field_custom_serializer
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:569: in _get_exporter
    return JsonItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c95ee0>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       json_indent = self.indent if self.indent is not None and self.indent > 0 else None
E       AttributeError: 'JsonItemExporter' object has no attribute 'indent'

/testbed/scrapy/exporters.py:49: AttributeError

test_exporters.py::JsonItemExporterDataclassTest::test_fields_to_export

test_exporters.py::JsonItemExporterDataclassTest::test_fields_to_export
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:569: in _get_exporter
    return JsonItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c97790>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       json_indent = self.indent if self.indent is not None and self.indent > 0 else None
E       AttributeError: 'JsonItemExporter' object has no attribute 'indent'

/testbed/scrapy/exporters.py:49: AttributeError

test_exporters.py::JsonItemExporterDataclassTest::test_nested_dict_item

test_exporters.py::JsonItemExporterDataclassTest::test_nested_dict_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:569: in _get_exporter
    return JsonItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c96200>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       json_indent = self.indent if self.indent is not None and self.indent > 0 else None
E       AttributeError: 'JsonItemExporter' object has no attribute 'indent'

/testbed/scrapy/exporters.py:49: AttributeError

test_exporters.py::JsonItemExporterDataclassTest::test_nested_item

test_exporters.py::JsonItemExporterDataclassTest::test_nested_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:569: in _get_exporter
    return JsonItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c97f60>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       json_indent = self.indent if self.indent is not None and self.indent > 0 else None
E       AttributeError: 'JsonItemExporter' object has no attribute 'indent'

/testbed/scrapy/exporters.py:49: AttributeError

test_exporters.py::JsonItemExporterDataclassTest::test_nonstring_types_item

test_exporters.py::JsonItemExporterDataclassTest::test_nonstring_types_item
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:569: in _get_exporter
    return JsonItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96cbc450>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       json_indent = self.indent if self.indent is not None and self.indent > 0 else None
E       AttributeError: 'JsonItemExporter' object has no attribute 'indent'

/testbed/scrapy/exporters.py:49: AttributeError

test_exporters.py::JsonItemExporterDataclassTest::test_serialize_field

test_exporters.py::JsonItemExporterDataclassTest::test_serialize_field
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:569: in _get_exporter
    return JsonItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c97790>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       json_indent = self.indent if self.indent is not None and self.indent > 0 else None
E       AttributeError: 'JsonItemExporter' object has no attribute 'indent'

/testbed/scrapy/exporters.py:49: AttributeError

test_exporters.py::JsonItemExporterDataclassTest::test_two_dict_items

test_exporters.py::JsonItemExporterDataclassTest::test_two_dict_items
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:569: in _get_exporter
    return JsonItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96c2c6d0>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       json_indent = self.indent if self.indent is not None and self.indent > 0 else None
E       AttributeError: 'JsonItemExporter' object has no attribute 'indent'

/testbed/scrapy/exporters.py:49: AttributeError

test_exporters.py::JsonItemExporterDataclassTest::test_two_items

test_exporters.py::JsonItemExporterDataclassTest::test_two_items
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:569: in _get_exporter
    return JsonItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96cbc5e0>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       json_indent = self.indent if self.indent is not None and self.indent > 0 else None
E       AttributeError: 'JsonItemExporter' object has no attribute 'indent'

/testbed/scrapy/exporters.py:49: AttributeError

test_exporters.py::JsonItemExporterDataclassTest::test_two_items_with_failure_between

test_exporters.py::JsonItemExporterDataclassTest::test_two_items_with_failure_between
self = 

    def setUp(self):
        self.i = self.item_class(name="John\xa3", age="22")
        self.output = BytesIO()
>       self.ie = self._get_exporter()

/testbed/tests/test_exporters.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_exporters.py:569: in _get_exporter
    return JsonItemExporter(self.output, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
file = <_io.BytesIO object at 0x7fcb96cbcc70>, kwargs = {}

    def __init__(self, file, **kwargs):
        super().__init__(dont_fail=True, **kwargs)
        self.file = file
>       json_indent = self.indent if self.indent is not None and self.indent > 0 else None
E       AttributeError: 'JsonItemExporter' object has no attribute 'indent'

/testbed/scrapy/exporters.py:49: AttributeError

test_exporters.py::CustomExporterItemTest::test_exporter_custom_serializer

test_exporters.py::CustomExporterItemTest::test_exporter_custom_serializer
self = 

    def test_exporter_custom_serializer(self):
        class CustomItemExporter(BaseItemExporter):
            def serialize_field(self, field, name, value):
                if name == "age":
                    return str(int(value) + 1)
                return super().serialize_field(field, name, value)

        i = self.item_class(name="John", age="22")
        a = ItemAdapter(i)
        ie = CustomItemExporter()

        self.assertEqual(
>           ie.serialize_field(a.get_field_meta("name"), "name", a["name"]), "John"
        )

/testbed/tests/test_exporters.py:686: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = .CustomItemExporter object at 0x7fcb96c3f7d0>
field = mappingproxy({}), name = 'name', value = 'John'

    def serialize_field(self, field, name, value):
        if name == "age":
            return str(int(value) + 1)
>       return super().serialize_field(field, name, value)
E       AttributeError: 'super' object has no attribute 'serialize_field'

/testbed/tests/test_exporters.py:679: AttributeError

test_exporters.py::CustomExporterDataclassTest::test_exporter_custom_serializer

test_exporters.py::CustomExporterDataclassTest::test_exporter_custom_serializer
self = 

    def test_exporter_custom_serializer(self):
        class CustomItemExporter(BaseItemExporter):
            def serialize_field(self, field, name, value):
                if name == "age":
                    return str(int(value) + 1)
                return super().serialize_field(field, name, value)

        i = self.item_class(name="John", age="22")
        a = ItemAdapter(i)
        ie = CustomItemExporter()

        self.assertEqual(
>           ie.serialize_field(a.get_field_meta("name"), "name", a["name"]), "John"
        )

/testbed/tests/test_exporters.py:686: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = .CustomItemExporter object at 0x7fcb96c3d040>
field = mappingproxy({}), name = 'name', value = 'John'

    def serialize_field(self, field, name, value):
        if name == "age":
            return str(int(value) + 1)
>       return super().serialize_field(field, name, value)
E       AttributeError: 'super' object has no attribute 'serialize_field'

/testbed/tests/test_exporters.py:679: AttributeError

test_http_cookies.py::WrappedRequestTest::test_add_unredirected_header

test_http_cookies.py::WrappedRequestTest::test_add_unredirected_header
self = 

    def test_add_unredirected_header(self):
>       self.wrapped.add_unredirected_header("hello", "world")
E       AttributeError: 'WrappedRequest' object has no attribute 'add_unredirected_header'

/testbed/tests/test_http_cookies.py:58: AttributeError

test_http_cookies.py::WrappedRequestTest::test_get_full_url

test_http_cookies.py::WrappedRequestTest::test_get_full_url
self = 

    def test_get_full_url(self):
>       self.assertEqual(self.wrapped.get_full_url(), self.request.url)
E       AttributeError: 'WrappedRequest' object has no attribute 'get_full_url'

/testbed/tests/test_http_cookies.py:16: AttributeError

test_http_cookies.py::WrappedRequestTest::test_get_header

test_http_cookies.py::WrappedRequestTest::test_get_header
self = 

    def test_get_header(self):
>       self.assertEqual(self.wrapped.get_header("content-type"), "text/html")
E       AttributeError: 'WrappedRequest' object has no attribute 'get_header'

/testbed/tests/test_http_cookies.py:44: AttributeError

test_http_cookies.py::WrappedRequestTest::test_get_host

test_http_cookies.py::WrappedRequestTest::test_get_host
self = 

    def test_get_host(self):
>       self.assertEqual(self.wrapped.get_host(), urlparse(self.request.url).netloc)
E       AttributeError: 'WrappedRequest' object has no attribute 'get_host'

/testbed/tests/test_http_cookies.py:20: AttributeError

test_http_cookies.py::WrappedRequestTest::test_get_origin_req_host

test_http_cookies.py::WrappedRequestTest::test_get_origin_req_host
self = 

    def test_get_origin_req_host(self):
>       self.assertEqual(self.wrapped.origin_req_host, "www.example.com")
E       AttributeError: 'WrappedRequest' object has no attribute 'origin_req_host'

/testbed/tests/test_http_cookies.py:37: AttributeError

test_http_cookies.py::WrappedRequestTest::test_get_type

test_http_cookies.py::WrappedRequestTest::test_get_type
self = 

    def test_get_type(self):
>       self.assertEqual(self.wrapped.get_type(), urlparse(self.request.url).scheme)
E       AttributeError: 'WrappedRequest' object has no attribute 'get_type'

/testbed/tests/test_http_cookies.py:24: AttributeError

test_http_cookies.py::WrappedRequestTest::test_has_header

test_http_cookies.py::WrappedRequestTest::test_has_header
self = 

    def test_has_header(self):
>       self.assertTrue(self.wrapped.has_header("content-type"))
E       AttributeError: 'WrappedRequest' object has no attribute 'has_header'

/testbed/tests/test_http_cookies.py:40: AttributeError

test_http_cookies.py::WrappedRequestTest::test_header_items

test_http_cookies.py::WrappedRequestTest::test_header_items
self = 

    def test_header_items(self):
>       self.assertEqual(self.wrapped.header_items(), [("Content-Type", ["text/html"])])
E       AttributeError: 'WrappedRequest' object has no attribute 'header_items'

/testbed/tests/test_http_cookies.py:55: AttributeError

test_http_cookies.py::WrappedRequestTest::test_is_unverifiable

test_http_cookies.py::WrappedRequestTest::test_is_unverifiable
self = 

    def test_is_unverifiable(self):
        self.assertFalse(self.wrapped.is_unverifiable())
>       self.assertFalse(self.wrapped.unverifiable)
E       AttributeError: 'WrappedRequest' object has no attribute 'unverifiable'. Did you mean: 'is_unverifiable'?

/testbed/tests/test_http_cookies.py:29: AttributeError

test_http_cookies.py::WrappedRequestTest::test_is_unverifiable2

test_http_cookies.py::WrappedRequestTest::test_is_unverifiable2
self = 

    def test_is_unverifiable2(self):
        self.request.meta["is_unverifiable"] = True
>       self.assertTrue(self.wrapped.is_unverifiable())
E       AssertionError: None is not true

/testbed/tests/test_http_cookies.py:33: AssertionError

test_http_cookies.py::WrappedResponseTest::test_get_all

test_http_cookies.py::WrappedResponseTest::test_get_all
self = 

    def test_get_all(self):
        # get_all result must be native string
>       self.assertEqual(self.wrapped.get_all("content-type"), ["text/html"])
E       AttributeError: 'WrappedResponse' object has no attribute 'get_all'

/testbed/tests/test_http_cookies.py:74: AttributeError

test_http_cookies.py::WrappedResponseTest::test_info

test_http_cookies.py::WrappedResponseTest::test_info
self = 

    def test_info(self):
>       self.assertIs(self.wrapped.info(), self.wrapped)
E       AttributeError: 'WrappedResponse' object has no attribute 'info'

/testbed/tests/test_http_cookies.py:70: AttributeError

test_http_headers.py::HeadersTest::test_appendlist

test_http_headers.py::HeadersTest::test_appendlist
self = 

    def test_appendlist(self):
        h1 = Headers({"header1": "value1"})
>       h1.appendlist("header1", "value3")
E       AttributeError: 'Headers' object has no attribute 'appendlist'

/testbed/tests/test_http_headers.py:115: AttributeError

test_http_headers.py::HeadersTest::test_basics

test_http_headers.py::HeadersTest::test_basics
self = 

    def test_basics(self):
        h = Headers({"Content-Type": "text/html", "Content-Length": 1234})
>       assert h["Content-Type"]

/testbed/tests/test_http_headers.py:13: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/http/headers.py:23: in __getitem__
    return super().__getitem__(key)[-1]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = {'Content-Type': 'text/html', 'Content-Length': 1234}
key = 'Content-Type'

    def __getitem__(self, key):
>       return dict.__getitem__(self, self.normkey(key))
E       KeyError: None

/testbed/scrapy/utils/datatypes.py:31: KeyError

test_http_headers.py::HeadersTest::test_copy

test_http_headers.py::HeadersTest::test_copy
self = 

    def test_copy(self):
        h1 = Headers({"header1": ["value1", "value2"]})
        h2 = copy.copy(h1)
        self.assertEqual(h1, h2)
>       self.assertEqual(h1.getlist("header1"), h2.getlist("header1"))
E       AttributeError: 'Headers' object has no attribute 'getlist'

/testbed/tests/test_http_headers.py:109: AttributeError

test_http_headers.py::HeadersTest::test_encode_latin1

test_http_headers.py::HeadersTest::test_encode_latin1
self = 

    def test_encode_latin1(self):
        h = Headers({"key": "\xa3"}, encoding="latin1")
        key, val = dict(h).popitem()
>       self.assertEqual(val[0], b"\xa3")
E       AssertionError: '£' != b'\xa3'

/testbed/tests/test_http_headers.py:58: AssertionError

test_http_headers.py::HeadersTest::test_encode_multiple

test_http_headers.py::HeadersTest::test_encode_multiple
self = 

    def test_encode_multiple(self):
        h = Headers({"key": ["\xa3"]}, encoding="utf-8")
        key, val = dict(h).popitem()
>       self.assertEqual(val[0], b"\xc2\xa3")
E       AssertionError: '£' != b'\xc2\xa3'

/testbed/tests/test_http_headers.py:63: AssertionError

test_http_headers.py::HeadersTest::test_encode_utf8

test_http_headers.py::HeadersTest::test_encode_utf8
self = 

    def test_encode_utf8(self):
        h = Headers({"key": "\xa3"}, encoding="utf-8")
        key, val = dict(h).popitem()
>       assert isinstance(key, bytes), key
E       AssertionError: key

/testbed/tests/test_http_headers.py:51: AssertionError

test_http_headers.py::HeadersTest::test_int_value

test_http_headers.py::HeadersTest::test_int_value
self = 

    def test_int_value(self):
        h1 = Headers({"hey": 5})
        h1["foo"] = 1
        h1.setdefault("bar", 2)
>       h1.setlist("buz", [1, "dos", 3])
E       AttributeError: 'Headers' object has no attribute 'setlist'

/testbed/tests/test_http_headers.py:148: AttributeError

test_http_headers.py::HeadersTest::test_invalid_value

test_http_headers.py::HeadersTest::test_invalid_value
self = 

    def test_invalid_value(self):
>       self.assertRaisesRegex(
            TypeError, "Unsupported value type", Headers, {"foo": object()}
        )
E       AssertionError: TypeError not raised by Headers

/testbed/tests/test_http_headers.py:155: AssertionError

test_http_headers.py::HeadersTest::test_iterables

test_http_headers.py::HeadersTest::test_iterables
self = 

    def test_iterables(self):
        idict = {"Content-Type": "text/html", "X-Forwarded-For": ["ip1", "ip2"]}

        h = Headers(idict)
>       self.assertDictEqual(
            dict(h),
            {b"Content-Type": [b"text/html"], b"X-Forwarded-For": [b"ip1", b"ip2"]},
        )
E       AssertionError: {'Content-Type': 'text/html', 'X-Forwarded-For': ['ip1', 'ip2']} != {b'Content-Type': [b'text/html'], b'X-Forwarded-For': [b'ip1', b'ip2']}
E       - {'Content-Type': 'text/html', 'X-Forwarded-For': ['ip1', 'ip2']}
E       + {b'Content-Type': [b'text/html'], b'X-Forwarded-For': [b'ip1', b'ip2']}
E       ?  +                ++           +  +                    +       +

/testbed/tests/test_http_headers.py:88: AssertionError

test_http_headers.py::HeadersTest::test_multivalue

test_http_headers.py::HeadersTest::test_multivalue
self = 

    def test_multivalue(self):
        h = Headers()
        h["X-Forwarded-For"] = hlist = ["ip1", "ip2"]
>       self.assertEqual(h["X-Forwarded-For"], b"ip2")

/testbed/tests/test_http_headers.py:37: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = {None: None}, key = 'X-Forwarded-For'

    def __getitem__(self, key):
        try:
>           return super().__getitem__(key)[-1]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/http/headers.py:23: TypeError

test_http_headers.py::HeadersTest::test_multivalue_for_one_header

test_http_headers.py::HeadersTest::test_multivalue_for_one_header
self = 

    def test_multivalue_for_one_header(self):
        h = Headers((("a", "b"), ("a", "c")))
>       self.assertEqual(h["a"], b"c")

/testbed/tests/test_http_headers.py:44: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/http/headers.py:23: in __getitem__
    return super().__getitem__(key)[-1]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = {'a': 'c'}, key = 'a'

    def __getitem__(self, key):
>       return dict.__getitem__(self, self.normkey(key))
E       KeyError: None

/testbed/scrapy/utils/datatypes.py:31: KeyError

test_http_headers.py::HeadersTest::test_none_value

test_http_headers.py::HeadersTest::test_none_value
self = 

    def test_none_value(self):
        h1 = Headers()
        h1["foo"] = "bar"
        h1["foo"] = None
        h1.setdefault("foo", "bar")
>       self.assertEqual(h1.get("foo"), None)
E       AssertionError: 'bar' != None

/testbed/tests/test_http_headers.py:141: AssertionError

test_http_headers.py::HeadersTest::test_setdefault

test_http_headers.py::HeadersTest::test_setdefault
self = 

    def test_setdefault(self):
        h = Headers()
        hlist = ["ip1", "ip2"]
        olist = h.setdefault("X-Forwarded-For", hlist)
>       assert h.getlist("X-Forwarded-For") is not hlist
E       AttributeError: 'Headers' object has no attribute 'getlist'

/testbed/tests/test_http_headers.py:76: AttributeError

test_http_headers.py::HeadersTest::test_setlist

test_http_headers.py::HeadersTest::test_setlist
self = 

    def test_setlist(self):
        h1 = Headers({"header1": "value1"})
>       self.assertEqual(h1.getlist("header1"), [b"value1"])
E       AttributeError: 'Headers' object has no attribute 'getlist'

/testbed/tests/test_http_headers.py:125: AttributeError

test_http_headers.py::HeadersTest::test_setlistdefault

test_http_headers.py::HeadersTest::test_setlistdefault
self = 

    def test_setlistdefault(self):
        h1 = Headers({"header1": "value1"})
>       h1.setlistdefault("header1", ["value2", "value3"])
E       AttributeError: 'Headers' object has no attribute 'setlistdefault'. Did you mean: 'setdefault'?

/testbed/tests/test_http_headers.py:131: AttributeError

test_http_headers.py::HeadersTest::test_single_value

test_http_headers.py::HeadersTest::test_single_value
self = 

    def test_single_value(self):
        h = Headers()
        h["Content-Type"] = "text/html"
>       self.assertEqual(h["Content-Type"], b"text/html")

/testbed/tests/test_http_headers.py:30: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = {None: None}, key = 'Content-Type'

    def __getitem__(self, key):
        try:
>           return super().__getitem__(key)[-1]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/http/headers.py:23: TypeError

test_http_headers.py::HeadersTest::test_update

test_http_headers.py::HeadersTest::test_update
self = 

    def test_update(self):
        h = Headers()
        h.update({"Content-Type": "text/html", "X-Forwarded-For": ["ip1", "ip2"]})
>       self.assertEqual(h.getlist("Content-Type"), [b"text/html"])
E       AttributeError: 'Headers' object has no attribute 'getlist'

/testbed/tests/test_http_headers.py:102: AttributeError

test_http_request.py::RequestTest::test_ajax_url

test_http_request.py::RequestTest::test_ajax_url
self = 

    def test_ajax_url(self):
        # ascii url
        r = self.request_class(url="http://www.example.com/ajax.html#!key=value")
>       self.assertEqual(
            r.url, "http://www.example.com/ajax.html?_escaped_fragment_=key%3Dvalue"
        )
E       AssertionError: 'http://www.example.com/ajax.html?_escaped_fragment_=key=value' != 'http://www.example.com/ajax.html?_escaped_fragment_=key%3Dvalue'
E       - http://www.example.com/ajax.html?_escaped_fragment_=key=value
E       ?                                                        ^
E       + http://www.example.com/ajax.html?_escaped_fragment_=key%3Dvalue
E       ?                                                        ^^^

/testbed/tests/test_http_request.py:191: AssertionError

test_http_request.py::RequestTest::test_from_curl

test_http_request.py::RequestTest::test_from_curl
self = 

    def test_from_curl(self):
        # Note: more curated tests regarding curl conversion are in
        # `test_utils_curl.py`
        curl_command = (
            "curl 'http://httpbin.org/post' -X POST -H 'Cookie: _gauges_unique"
            "_year=1; _gauges_unique=1; _gauges_unique_month=1; _gauges_unique"
            "_hour=1; _gauges_unique_day=1' -H 'Origin: http://httpbin.org' -H"
            " 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q"
            "=0.9,ru;q=0.8,es;q=0.7' -H 'Upgrade-Insecure-Requests: 1' -H 'Use"
            "r-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTM"
            "L, like Gecko) Ubuntu Chromium/62.0.3202.75 Chrome/62.0.3202.75 S"
            "afari/537.36' -H 'Content-Type: application /x-www-form-urlencode"
            "d' -H 'Accept: text/html,application/xhtml+xml,application/xml;q="
            "0.9,image/webp,image/apng,*/*;q=0.8' -H 'Cache-Control: max-age=0"
            "' -H 'Referer: http://httpbin.org/forms/post' -H 'Connection: kee"
            "p-alive' --data 'custname=John+Smith&custtel=500&custemail=jsmith"
            "%40example.org&size=small&topping=cheese&topping=onion&delivery=1"
            "2%3A15&comments=' --compressed"
        )
>       r = self.request_class.from_curl(curl_command)

/testbed/tests/test_http_request.py:356: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = 
curl_command = "curl 'http://httpbin.org/post' -X POST -H 'Cookie: _gauges_unique_year=1; _gauges_unique=1; _gauges_unique_month=1; _...el=500&custemail=jsmith%40example.org&size=small&topping=cheese&topping=onion&delivery=12%3A15&comments=' --compressed"
ignore_unknown_options = True, kwargs = {}, request_kwargs = None

    @classmethod
    def from_curl(
        cls: Type[RequestTypeVar],
        curl_command: str,
        ignore_unknown_options: bool = True,
        **kwargs,
    ) -> RequestTypeVar:
        """Create a Request object from a string containing a `cURL
        `_ command. It populates the HTTP method, the
        URL, the headers, the cookies and the body. It accepts the same
        arguments as the :class:`Request` class, taking preference and
        overriding the values of the same arguments contained in the cURL
        command.

        Unrecognized options are ignored by default. To raise an error when
        finding unknown options call this method by passing
        ``ignore_unknown_options=False``.

        .. caution:: Using :meth:`from_curl` from :class:`~scrapy.http.Request`
                     subclasses, such as :class:`~scrapy.http.JSONRequest`, or
                     :class:`~scrapy.http.XmlRpcRequest`, as well as having
                     :ref:`downloader middlewares `
                     and
                     :ref:`spider middlewares `
                     enabled, such as
                     :class:`~scrapy.downloadermiddlewares.defaultheaders.DefaultHeadersMiddleware`,
                     :class:`~scrapy.downloadermiddlewares.useragent.UserAgentMiddleware`,
                     or
                     :class:`~scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware`,
                     may modify the :class:`~scrapy.http.Request` object.

        To translate a cURL command into a Scrapy request,
        you may use `curl2scrapy `_.
        """
        request_kwargs = curl_to_request_kwargs(curl_command, ignore_unknown_options)
>       request_kwargs.update(kwargs)
E       AttributeError: 'NoneType' object has no attribute 'update'

/testbed/scrapy/http/request/__init__.py:207: AttributeError

test_http_request.py::RequestTest::test_from_curl_ignore_unknown_options

test_http_request.py::RequestTest::test_from_curl_ignore_unknown_options
self = 

    def test_from_curl_ignore_unknown_options(self):
        # By default: it works and ignores the unknown options: --foo and -z
        with warnings.catch_warnings():  # avoid warning when executing tests
            warnings.simplefilter("ignore")
>           r = self.request_class.from_curl(
                'curl -X DELETE "http://example.org" --foo -z',
            )

/testbed/tests/test_http_request.py:409: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = 
curl_command = 'curl -X DELETE "http://example.org" --foo -z'
ignore_unknown_options = True, kwargs = {}, request_kwargs = None

    @classmethod
    def from_curl(
        cls: Type[RequestTypeVar],
        curl_command: str,
        ignore_unknown_options: bool = True,
        **kwargs,
    ) -> RequestTypeVar:
        """Create a Request object from a string containing a `cURL
        `_ command. It populates the HTTP method, the
        URL, the headers, the cookies and the body. It accepts the same
        arguments as the :class:`Request` class, taking preference and
        overriding the values of the same arguments contained in the cURL
        command.

        Unrecognized options are ignored by default. To raise an error when
        finding unknown options call this method by passing
        ``ignore_unknown_options=False``.

        .. caution:: Using :meth:`from_curl` from :class:`~scrapy.http.Request`
                     subclasses, such as :class:`~scrapy.http.JSONRequest`, or
                     :class:`~scrapy.http.XmlRpcRequest`, as well as having
                     :ref:`downloader middlewares `
                     and
                     :ref:`spider middlewares `
                     enabled, such as
                     :class:`~scrapy.downloadermiddlewares.defaultheaders.DefaultHeadersMiddleware`,
                     :class:`~scrapy.downloadermiddlewares.useragent.UserAgentMiddleware`,
                     or
                     :class:`~scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware`,
                     may modify the :class:`~scrapy.http.Request` object.

        To translate a cURL command into a Scrapy request,
        you may use `curl2scrapy `_.
        """
        request_kwargs = curl_to_request_kwargs(curl_command, ignore_unknown_options)
>       request_kwargs.update(kwargs)
E       AttributeError: 'NoneType' object has no attribute 'update'

/testbed/scrapy/http/request/__init__.py:207: AttributeError

test_http_request.py::RequestTest::test_from_curl_with_kwargs

test_http_request.py::RequestTest::test_from_curl_with_kwargs
self = 

    def test_from_curl_with_kwargs(self):
>       r = self.request_class.from_curl(
            'curl -X PATCH "http://example.org"', method="POST", meta={"key": "value"}
        )

/testbed/tests/test_http_request.py:399: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = 
curl_command = 'curl -X PATCH "http://example.org"'
ignore_unknown_options = True
kwargs = {'meta': {'key': 'value'}, 'method': 'POST'}, request_kwargs = None

    @classmethod
    def from_curl(
        cls: Type[RequestTypeVar],
        curl_command: str,
        ignore_unknown_options: bool = True,
        **kwargs,
    ) -> RequestTypeVar:
        """Create a Request object from a string containing a `cURL
        `_ command. It populates the HTTP method, the
        URL, the headers, the cookies and the body. It accepts the same
        arguments as the :class:`Request` class, taking preference and
        overriding the values of the same arguments contained in the cURL
        command.

        Unrecognized options are ignored by default. To raise an error when
        finding unknown options call this method by passing
        ``ignore_unknown_options=False``.

        .. caution:: Using :meth:`from_curl` from :class:`~scrapy.http.Request`
                     subclasses, such as :class:`~scrapy.http.JSONRequest`, or
                     :class:`~scrapy.http.XmlRpcRequest`, as well as having
                     :ref:`downloader middlewares `
                     and
                     :ref:`spider middlewares `
                     enabled, such as
                     :class:`~scrapy.downloadermiddlewares.defaultheaders.DefaultHeadersMiddleware`,
                     :class:`~scrapy.downloadermiddlewares.useragent.UserAgentMiddleware`,
                     or
                     :class:`~scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware`,
                     may modify the :class:`~scrapy.http.Request` object.

        To translate a cURL command into a Scrapy request,
        you may use `curl2scrapy `_.
        """
        request_kwargs = curl_to_request_kwargs(curl_command, ignore_unknown_options)
>       request_kwargs.update(kwargs)
E       AttributeError: 'NoneType' object has no attribute 'update'

/testbed/scrapy/http/request/__init__.py:207: AttributeError

test_http_request.py::RequestTest::test_headers

test_http_request.py::RequestTest::test_headers
self = 

    def test_headers(self):
        # Different ways of setting headers attribute
        url = "http://www.scrapy.org"
        headers = {b"Accept": "gzip", b"Custom-Header": "nothing to tell you"}
        r = self.request_class(url=url, headers=headers)
        p = self.request_class(url=url, headers=r.headers)

        self.assertEqual(r.headers, p.headers)
        self.assertFalse(r.headers is headers)
        self.assertFalse(p.headers is r.headers)

        # headers must not be unicode
        h = Headers({"key1": "val1", "key2": "val2"})
        h["newkey"] = "newval"
        for k, v in h.items():
>           self.assertIsInstance(k, bytes)
E           AssertionError: 'key1' is not an instance of 

/testbed/tests/test_http_request.py:84: AssertionError

test_http_request.py::RequestTest::test_immutable_attributes

test_http_request.py::RequestTest::test_immutable_attributes
self = 

    def test_immutable_attributes(self):
        r = self.request_class("http://example.com")
>       self.assertRaises(AttributeError, setattr, r, "url", "http://example2.com")

/testbed/tests/test_http_request.py:286: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def wrapper(self, value):
        private_name = f"_{name}"
        if not hasattr(self, private_name):
>           warnings.warn(f"Property {name} is deprecated.", category=warn_category, stacklevel=2)
E           TypeError: category must be a Warning subclass, not 'str'

/testbed/scrapy/http/common.py:10: TypeError

test_http_request.py::RequestTest::test_init

test_http_request.py::RequestTest::test_init
self = 

    def test_init(self):
        # Request requires url in the __init__ method
        self.assertRaises(Exception, self.request_class)

        # url argument must be basestring
        self.assertRaises(TypeError, self.request_class, 123)
        r = self.request_class("http://www.example.com")

        r = self.request_class("http://www.example.com")
        assert isinstance(r.url, str)
        self.assertEqual(r.url, "http://www.example.com")
        self.assertEqual(r.method, self.default_method)

        assert isinstance(r.headers, Headers)
        self.assertEqual(r.headers, self.default_headers)
        self.assertEqual(r.meta, self.default_meta)

        meta = {"lala": "lolo"}
        headers = {b"caca": b"coco"}
        r = self.request_class(
            "http://www.example.com", meta=meta, headers=headers, body="a body"
        )

        assert r.meta is not meta
        self.assertEqual(r.meta, meta)
        assert r.headers is not headers
>       self.assertEqual(r.headers[b"caca"], b"coco")

/testbed/tests/test_http_request.py:53: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/http/headers.py:23: in __getitem__
    return super().__getitem__(key)[-1]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = {b'caca': b'coco'}, key = b'caca'

    def __getitem__(self, key):
>       return dict.__getitem__(self, self.normkey(key))
E       KeyError: None

/testbed/scrapy/utils/datatypes.py:31: KeyError

test_http_request.py::FormRequestTest::test_ajax_url

test_http_request.py::FormRequestTest::test_ajax_url
self = 

    def test_ajax_url(self):
        # ascii url
        r = self.request_class(url="http://www.example.com/ajax.html#!key=value")
>       self.assertEqual(
            r.url, "http://www.example.com/ajax.html?_escaped_fragment_=key%3Dvalue"
        )
E       AssertionError: 'http://www.example.com/ajax.html?_escaped_fragment_=key=value' != 'http://www.example.com/ajax.html?_escaped_fragment_=key%3Dvalue'
E       - http://www.example.com/ajax.html?_escaped_fragment_=key=value
E       ?                                                        ^
E       + http://www.example.com/ajax.html?_escaped_fragment_=key%3Dvalue
E       ?                                                        ^^^

/testbed/tests/test_http_request.py:191: AssertionError

test_http_request.py::FormRequestTest::test_custom_encoding_bytes

test_http_request.py::FormRequestTest::test_custom_encoding_bytes
self = 

    def test_custom_encoding_bytes(self):
        data = {b"\xb5 one": b"two", b"price": b"\xa3 100"}
>       r2 = self.request_class(
            "http://www.example.com", formdata=data, encoding="latin1"
        )

/testbed/tests/test_http_request.py:489: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
formdata = {b'price': b'\xa3 100', b'\xb5 one': b'two'}
args = ('http://www.example.com',)
kwargs = {'encoding': 'latin1', 'method': 'POST'}
items = dict_items([(b'\xb5 one', b'two'), (b'price', b'\xa3 100')])

    def __init__(self, *args, formdata: FormdataType=None, **kwargs) -> None:
        if formdata and kwargs.get('method') is None:
            kwargs['method'] = 'POST'
        super().__init__(*args, **kwargs)
        if formdata:
            items = formdata.items() if isinstance(formdata, dict) else formdata
>           form_query_str = _urlencode(items, self.encoding)
E           NameError: name '_urlencode' is not defined

/testbed/scrapy/http/request/form.py:31: NameError

test_http_request.py::FormRequestTest::test_custom_encoding_textual_data

test_http_request.py::FormRequestTest::test_custom_encoding_textual_data
self = 

    def test_custom_encoding_textual_data(self):
        data = {"price": "£ 100"}
>       r3 = self.request_class(
            "http://www.example.com", formdata=data, encoding="latin1"
        )

/testbed/tests/test_http_request.py:501: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = , formdata = {'price': '£ 100'}
args = ('http://www.example.com',)
kwargs = {'encoding': 'latin1', 'method': 'POST'}
items = dict_items([('price', '£ 100')])

    def __init__(self, *args, formdata: FormdataType=None, **kwargs) -> None:
        if formdata and kwargs.get('method') is None:
            kwargs['method'] = 'POST'
        super().__init__(*args, **kwargs)
        if formdata:
            items = formdata.items() if isinstance(formdata, dict) else formdata
>           form_query_str = _urlencode(items, self.encoding)
E           NameError: name '_urlencode' is not defined

/testbed/scrapy/http/request/form.py:31: NameError

test_http_request.py::FormRequestTest::test_default_encoding_bytes

test_http_request.py::FormRequestTest::test_default_encoding_bytes
self = 

    def test_default_encoding_bytes(self):
        # using default encoding (utf-8)
        data = {b"one": b"two", b"price": b"\xc2\xa3 100"}
>       r2 = self.request_class("http://www.example.com", formdata=data)

/testbed/tests/test_http_request.py:457: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
formdata = {b'one': b'two', b'price': b'\xc2\xa3 100'}
args = ('http://www.example.com',), kwargs = {'method': 'POST'}
items = dict_items([(b'one', b'two'), (b'price', b'\xc2\xa3 100')])

    def __init__(self, *args, formdata: FormdataType=None, **kwargs) -> None:
        if formdata and kwargs.get('method') is None:
            kwargs['method'] = 'POST'
        super().__init__(*args, **kwargs)
        if formdata:
            items = formdata.items() if isinstance(formdata, dict) else formdata
>           form_query_str = _urlencode(items, self.encoding)
E           NameError: name '_urlencode' is not defined

/testbed/scrapy/http/request/form.py:31: NameError

test_http_request.py::FormRequestTest::test_default_encoding_mixed_data

test_http_request.py::FormRequestTest::test_default_encoding_mixed_data
self = 

    def test_default_encoding_mixed_data(self):
        # using default encoding (utf-8)
        data = {"\u00b5one": b"two", b"price\xc2\xa3": "\u00a3 100"}
>       r2 = self.request_class("http://www.example.com", formdata=data)

/testbed/tests/test_http_request.py:479: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
formdata = {'µone': b'two', b'price\xc2\xa3': '£ 100'}
args = ('http://www.example.com',), kwargs = {'method': 'POST'}
items = dict_items([('µone', b'two'), (b'price\xc2\xa3', '£ 100')])

    def __init__(self, *args, formdata: FormdataType=None, **kwargs) -> None:
        if formdata and kwargs.get('method') is None:
            kwargs['method'] = 'POST'
        super().__init__(*args, **kwargs)
        if formdata:
            items = formdata.items() if isinstance(formdata, dict) else formdata
>           form_query_str = _urlencode(items, self.encoding)
E           NameError: name '_urlencode' is not defined

/testbed/scrapy/http/request/form.py:31: NameError

test_http_request.py::FormRequestTest::test_default_encoding_textual_data

test_http_request.py::FormRequestTest::test_default_encoding_textual_data
self = 

    def test_default_encoding_textual_data(self):
        # using default encoding (utf-8)
        data = {"µ one": "two", "price": "£ 100"}
>       r2 = self.request_class("http://www.example.com", formdata=data)

/testbed/tests/test_http_request.py:468: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
formdata = {'price': '£ 100', 'µ one': 'two'}
args = ('http://www.example.com',), kwargs = {'method': 'POST'}
items = dict_items([('µ one', 'two'), ('price', '£ 100')])

    def __init__(self, *args, formdata: FormdataType=None, **kwargs) -> None:
        if formdata and kwargs.get('method') is None:
            kwargs['method'] = 'POST'
        super().__init__(*args, **kwargs)
        if formdata:
            items = formdata.items() if isinstance(formdata, dict) else formdata
>           form_query_str = _urlencode(items, self.encoding)
E           NameError: name '_urlencode' is not defined

/testbed/scrapy/http/request/form.py:31: NameError

test_http_request.py::FormRequestTest::test_formdata_overrides_querystring

test_http_request.py::FormRequestTest::test_formdata_overrides_querystring
self = 

    def test_formdata_overrides_querystring(self):
        data = (("a", "one"), ("a", "two"), ("b", "2"))
>       url = self.request_class(
            "http://www.example.com/?a=0&b=1&c=3#fragment", method="GET", formdata=data
        ).url.split("#")[0]

/testbed/tests/test_http_request.py:439: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
formdata = (('a', 'one'), ('a', 'two'), ('b', '2'))
args = ('http://www.example.com/?a=0&b=1&c=3#fragment',)
kwargs = {'method': 'GET'}, items = (('a', 'one'), ('a', 'two'), ('b', '2'))

    def __init__(self, *args, formdata: FormdataType=None, **kwargs) -> None:
        if formdata and kwargs.get('method') is None:
            kwargs['method'] = 'POST'
        super().__init__(*args, **kwargs)
        if formdata:
            items = formdata.items() if isinstance(formdata, dict) else formdata
>           form_query_str = _urlencode(items, self.encoding)
E           NameError: name '_urlencode' is not defined

/testbed/scrapy/http/request/form.py:31: NameError

test_http_request.py::FormRequestTest::test_from_curl

test_http_request.py::FormRequestTest::test_from_curl
self = 

    def test_from_curl(self):
        # Note: more curated tests regarding curl conversion are in
        # `test_utils_curl.py`
        curl_command = (
            "curl 'http://httpbin.org/post' -X POST -H 'Cookie: _gauges_unique"
            "_year=1; _gauges_unique=1; _gauges_unique_month=1; _gauges_unique"
            "_hour=1; _gauges_unique_day=1' -H 'Origin: http://httpbin.org' -H"
            " 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q"
            "=0.9,ru;q=0.8,es;q=0.7' -H 'Upgrade-Insecure-Requests: 1' -H 'Use"
            "r-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTM"
            "L, like Gecko) Ubuntu Chromium/62.0.3202.75 Chrome/62.0.3202.75 S"
            "afari/537.36' -H 'Content-Type: application /x-www-form-urlencode"
            "d' -H 'Accept: text/html,application/xhtml+xml,application/xml;q="
            "0.9,image/webp,image/apng,*/*;q=0.8' -H 'Cache-Control: max-age=0"
            "' -H 'Referer: http://httpbin.org/forms/post' -H 'Connection: kee"
            "p-alive' --data 'custname=John+Smith&custtel=500&custemail=jsmith"
            "%40example.org&size=small&topping=cheese&topping=onion&delivery=1"
            "2%3A15&comments=' --compressed"
        )
>       r = self.request_class.from_curl(curl_command)

/testbed/tests/test_http_request.py:356: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = 
curl_command = "curl 'http://httpbin.org/post' -X POST -H 'Cookie: _gauges_unique_year=1; _gauges_unique=1; _gauges_unique_month=1; _...el=500&custemail=jsmith%40example.org&size=small&topping=cheese&topping=onion&delivery=12%3A15&comments=' --compressed"
ignore_unknown_options = True, kwargs = {}, request_kwargs = None

    @classmethod
    def from_curl(
        cls: Type[RequestTypeVar],
        curl_command: str,
        ignore_unknown_options: bool = True,
        **kwargs,
    ) -> RequestTypeVar:
        """Create a Request object from a string containing a `cURL
        `_ command. It populates the HTTP method, the
        URL, the headers, the cookies and the body. It accepts the same
        arguments as the :class:`Request` class, taking preference and
        overriding the values of the same arguments contained in the cURL
        command.

        Unrecognized options are ignored by default. To raise an error when
        finding unknown options call this method by passing
        ``ignore_unknown_options=False``.

        .. caution:: Using :meth:`from_curl` from :class:`~scrapy.http.Request`
                     subclasses, such as :class:`~scrapy.http.JSONRequest`, or
                     :class:`~scrapy.http.XmlRpcRequest`, as well as having
                     :ref:`downloader middlewares `
                     and
                     :ref:`spider middlewares `
                     enabled, such as
                     :class:`~scrapy.downloadermiddlewares.defaultheaders.DefaultHeadersMiddleware`,
                     :class:`~scrapy.downloadermiddlewares.useragent.UserAgentMiddleware`,
                     or
                     :class:`~scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware`,
                     may modify the :class:`~scrapy.http.Request` object.

        To translate a cURL command into a Scrapy request,
        you may use `curl2scrapy `_.
        """
        request_kwargs = curl_to_request_kwargs(curl_command, ignore_unknown_options)
>       request_kwargs.update(kwargs)
E       AttributeError: 'NoneType' object has no attribute 'update'

/testbed/scrapy/http/request/__init__.py:207: AttributeError

test_http_request.py::FormRequestTest::test_from_curl_ignore_unknown_options

test_http_request.py::FormRequestTest::test_from_curl_ignore_unknown_options
self = 

    def test_from_curl_ignore_unknown_options(self):
        # By default: it works and ignores the unknown options: --foo and -z
        with warnings.catch_warnings():  # avoid warning when executing tests
            warnings.simplefilter("ignore")
>           r = self.request_class.from_curl(
                'curl -X DELETE "http://example.org" --foo -z',
            )

/testbed/tests/test_http_request.py:409: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = 
curl_command = 'curl -X DELETE "http://example.org" --foo -z'
ignore_unknown_options = True, kwargs = {}, request_kwargs = None

    @classmethod
    def from_curl(
        cls: Type[RequestTypeVar],
        curl_command: str,
        ignore_unknown_options: bool = True,
        **kwargs,
    ) -> RequestTypeVar:
        """Create a Request object from a string containing a `cURL
        `_ command. It populates the HTTP method, the
        URL, the headers, the cookies and the body. It accepts the same
        arguments as the :class:`Request` class, taking preference and
        overriding the values of the same arguments contained in the cURL
        command.

        Unrecognized options are ignored by default. To raise an error when
        finding unknown options call this method by passing
        ``ignore_unknown_options=False``.

        .. caution:: Using :meth:`from_curl` from :class:`~scrapy.http.Request`
                     subclasses, such as :class:`~scrapy.http.JSONRequest`, or
                     :class:`~scrapy.http.XmlRpcRequest`, as well as having
                     :ref:`downloader middlewares `
                     and
                     :ref:`spider middlewares `
                     enabled, such as
                     :class:`~scrapy.downloadermiddlewares.defaultheaders.DefaultHeadersMiddleware`,
                     :class:`~scrapy.downloadermiddlewares.useragent.UserAgentMiddleware`,
                     or
                     :class:`~scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware`,
                     may modify the :class:`~scrapy.http.Request` object.

        To translate a cURL command into a Scrapy request,
        you may use `curl2scrapy `_.
        """
        request_kwargs = curl_to_request_kwargs(curl_command, ignore_unknown_options)
>       request_kwargs.update(kwargs)
E       AttributeError: 'NoneType' object has no attribute 'update'

/testbed/scrapy/http/request/__init__.py:207: AttributeError

test_http_request.py::FormRequestTest::test_from_curl_with_kwargs

test_http_request.py::FormRequestTest::test_from_curl_with_kwargs
self = 

    def test_from_curl_with_kwargs(self):
>       r = self.request_class.from_curl(
            'curl -X PATCH "http://example.org"', method="POST", meta={"key": "value"}
        )

/testbed/tests/test_http_request.py:399: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = 
curl_command = 'curl -X PATCH "http://example.org"'
ignore_unknown_options = True
kwargs = {'meta': {'key': 'value'}, 'method': 'POST'}, request_kwargs = None

    @classmethod
    def from_curl(
        cls: Type[RequestTypeVar],
        curl_command: str,
        ignore_unknown_options: bool = True,
        **kwargs,
    ) -> RequestTypeVar:
        """Create a Request object from a string containing a `cURL
        `_ command. It populates the HTTP method, the
        URL, the headers, the cookies and the body. It accepts the same
        arguments as the :class:`Request` class, taking preference and
        overriding the values of the same arguments contained in the cURL
        command.

        Unrecognized options are ignored by default. To raise an error when
        finding unknown options call this method by passing
        ``ignore_unknown_options=False``.

        .. caution:: Using :meth:`from_curl` from :class:`~scrapy.http.Request`
                     subclasses, such as :class:`~scrapy.http.JSONRequest`, or
                     :class:`~scrapy.http.XmlRpcRequest`, as well as having
                     :ref:`downloader middlewares `
                     and
                     :ref:`spider middlewares `
                     enabled, such as
                     :class:`~scrapy.downloadermiddlewares.defaultheaders.DefaultHeadersMiddleware`,
                     :class:`~scrapy.downloadermiddlewares.useragent.UserAgentMiddleware`,
                     or
                     :class:`~scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware`,
                     may modify the :class:`~scrapy.http.Request` object.

        To translate a cURL command into a Scrapy request,
        you may use `curl2scrapy `_.
        """
        request_kwargs = curl_to_request_kwargs(curl_command, ignore_unknown_options)
>       request_kwargs.update(kwargs)
E       AttributeError: 'NoneType' object has no attribute 'update'

/testbed/scrapy/http/request/__init__.py:207: AttributeError

test_http_request.py::FormRequestTest::test_from_response_ambiguous_clickdata

test_http_request.py::FormRequestTest::test_from_response_ambiguous_clickdata
self = 

    def test_from_response_ambiguous_clickdata(self):
>       response = _buildresponse(
            """
            
""" ) /testbed/tests/test_http_request.py:901: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb962e9f70> body = '\n
\n \n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_button_notype

test_http_request.py::FormRequestTest::test_from_response_button_notype
self = 

    def test_from_response_button_notype(self):
>       response = _buildresponse(
            """
""", url="http://www.example.com/this/list.html", ) /testbed/tests/test_http_request.py:1303: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb962ea2a0> body = '
\n \n \n \n ' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_button_novalue

test_http_request.py::FormRequestTest::test_from_response_button_novalue
self = 

    def test_from_response_button_novalue(self):
>       response = _buildresponse(
            """
""", url="http://www.example.com/this/list.html", ) /testbed/tests/test_http_request.py:1343: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb962eb050> body = '
\n \n \n \n ' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_button_submit

test_http_request.py::FormRequestTest::test_from_response_button_submit
self = 

    def test_from_response_button_submit(self):
>       response = _buildresponse(
            """
""", url="http://www.example.com/this/list.html", ) /testbed/tests/test_http_request.py:1283: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb9635d910> body = '
\n \n \n \n ' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_case_insensitive

test_http_request.py::FormRequestTest::test_from_response_case_insensitive
self = 

    def test_from_response_case_insensitive(self):
>       response = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:725: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb962e99d0> body = '
\n \n ...http://my.image.org/1.jpg">\n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_checkbox

test_http_request.py::FormRequestTest::test_from_response_checkbox
self = 

    def test_from_response_checkbox(self):
>       res = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:1157: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb962eb200> body = '
\n \n \n \n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_clickdata_does_not_ignore_image

test_http_request.py::FormRequestTest::test_from_response_clickdata_does_not_ignore_image
self = 

    def test_from_response_clickdata_does_not_ignore_image(self):
>       response = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:798: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb962e9f40> body = '
\n \n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_css

test_http_request.py::FormRequestTest::test_from_response_css
self = 

    def test_from_response_css(self):
>       response = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:1386: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb962e9a90> body = '
\n \n \n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_descendants

test_http_request.py::FormRequestTest::test_from_response_descendants
self = 

    def test_from_response_descendants(self):
>       res = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:1214: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb962ebdd0> body = '
\n
\n
\n \n <...="h1" value="h1v">\n
\n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_dont_click

test_http_request.py::FormRequestTest::test_from_response_dont_click
self = 

    def test_from_response_dont_click(self):
>       response = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:887: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb962e82f0> body = '
\n \n ...dden" name="two" value="3">\n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_dont_submit_image_as_input

test_http_request.py::FormRequestTest::test_from_response_dont_submit_image_as_input
self = 

    def test_from_response_dont_submit_image_as_input(self):
>       response = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:773: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb963ebd40> body = '
\n \n \n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_dont_submit_reset_as_input

test_http_request.py::FormRequestTest::test_from_response_dont_submit_reset_as_input
self = 

    def test_from_response_dont_submit_reset_as_input(self):
>       response = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:785: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb963e5250> body = '
\n \n \n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_drop_params

test_http_request.py::FormRequestTest::test_from_response_drop_params
self = 

    def test_from_response_drop_params(self):
>       response = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:689: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb963e63c0> body = '
\n \n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_duplicate_form_key

test_http_request.py::FormRequestTest::test_from_response_duplicate_form_key
self = 

    def test_from_response_duplicate_form_key(self):
>       response = _buildresponse("
", url="http://www.example.com") /testbed/tests/test_http_request.py:613: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb963e76e0> body = '
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_errors_formnumber

test_http_request.py::FormRequestTest::test_from_response_errors_formnumber
self = 

    def test_from_response_errors_formnumber(self):
>       response = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:969: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb963e46e0> body = '
\n \n \n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_errors_noform

test_http_request.py::FormRequestTest::test_from_response_errors_noform
self = 

    def test_from_response_errors_noform(self):
>       response = _buildresponse("""""")

/testbed/tests/test_http_request.py:955: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_http_request.py:1433: in _buildresponse
    return HtmlResponse(**kwargs)
/testbed/scrapy/http/response/text.py:33: in __init__
    super().__init__(*args, **kwargs)
/testbed/scrapy/http/response/__init__.py:55: in __init__
    self._set_body(body)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb963e4890>
body = ''

    def _set_body(self, body):
        if body is None:
            self._body = b""
        elif not isinstance(body, bytes):
>           raise TypeError(
                "Response body must be bytes. "
                "If you want to pass unicode body use TextResponse "
                "or HtmlResponse."
            )
E           TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse.

/testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_extra_headers

test_http_request.py::FormRequestTest::test_from_response_extra_headers
self = 

    def test_from_response_extra_headers(self):
>       response = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:637: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb963e4d70> body = '
\n \n \n \n ' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_formid_errors_formnumber

test_http_request.py::FormRequestTest::test_from_response_formid_errors_formnumber
self = 

    def test_from_response_formid_errors_formnumber(self):
>       response = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:1091: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb963e52b0> body = '
\n \n ...="form2" action="post.php" method="POST">\n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_formid_exists

test_http_request.py::FormRequestTest::test_from_response_formid_exists
self = 

    def test_from_response_formid_exists(self):
>       response = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:1043: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb963e69f0> body = '
\n \n \n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_formid_nonexistent

test_http_request.py::FormRequestTest::test_from_response_formid_nonexistent
self = 

    def test_from_response_formid_nonexistent(self):
>       response = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:1077: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb96265040> body = '
\n \n ...="form2" action="post.php" method="POST">\n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_formname_errors_formnumber

test_http_request.py::FormRequestTest::test_from_response_formname_errors_formnumber
self = 

    def test_from_response_formname_errors_formnumber(self):
>       response = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:1026: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb96265c70> body = '
\n \n ...="form2" action="post.php" method="POST">\n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_formname_exists

test_http_request.py::FormRequestTest::test_from_response_formname_exists
self = 

    def test_from_response_formname_exists(self):
>       response = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:996: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb963e4ec0> body = '
\n \n \n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_formname_nonexistent

test_http_request.py::FormRequestTest::test_from_response_formname_nonexistent
self = 

    def test_from_response_formname_nonexistent(self):
>       response = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:1012: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb96266c00> body = '
\n \n ...="form2" action="post.php" method="POST">\n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_formname_nonexistent_fallback_formid

test_http_request.py::FormRequestTest::test_from_response_formname_nonexistent_fallback_formid
self = 

    def test_from_response_formname_nonexistent_fallback_formid(self):
>       response = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:1059: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb962664b0> body = '
\n \n \n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_get

test_http_request.py::FormRequestTest::test_from_response_get
self = 

    def test_from_response_get(self):
>       response = _buildresponse(
            """
""", url="http://www.example.com/this/list.html", ) /testbed/tests/test_http_request.py:656: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb96265df0> body = '
\n \n \n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_input_hidden

test_http_request.py::FormRequestTest::test_from_response_input_hidden
self = 

    def test_from_response_input_hidden(self):
>       res = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:1188: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb96264680> body = '
\n \n \n \n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_input_text

test_http_request.py::FormRequestTest::test_from_response_input_text
self = 

    def test_from_response_input_text(self):
>       res = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:1174: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb96265a30> body = '
\n \n \n ..."text" value="i3v1">\n \n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_input_textarea

test_http_request.py::FormRequestTest::test_from_response_input_textarea
self = 

    def test_from_response_input_textarea(self):
>       res = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:1201: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb96266420> body = '
\n \n \n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_invalid_html5

test_http_request.py::FormRequestTest::test_from_response_invalid_html5
self = 

    def test_from_response_invalid_html5(self):
>       response = _buildresponse(
            """
""" """""" """
""" ) /testbed/tests/test_http_request.py:959: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb96264e00> body = '
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_invalid_nr_index_clickdata

test_http_request.py::FormRequestTest::test_from_response_invalid_nr_index_clickdata
self = 

    def test_from_response_invalid_nr_index_clickdata(self):
>       response = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:944: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb96267bf0> body = '
\n \n
\n ' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_multiple_clickdata

test_http_request.py::FormRequestTest::test_from_response_multiple_clickdata
self = 

    def test_from_response_multiple_clickdata(self):
>       response = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:809: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb962d1ac0> body = '
\n \n ...dden" name="one" value="clicked1">\n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_multiple_forms_clickdata

test_http_request.py::FormRequestTest::test_from_response_multiple_forms_clickdata
self = 

    def test_from_response_multiple_forms_clickdata(self):
>       response = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:857: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb962d26c0> body = '
\n \n \n \n
\n ' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_noformname

test_http_request.py::FormRequestTest::test_from_response_noformname
self = 

    def test_from_response_noformname(self):
>       response = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:981: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb962d3620> body = '
\n \n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_non_matching_clickdata

test_http_request.py::FormRequestTest::test_from_response_non_matching_clickdata
self = 

    def test_from_response_non_matching_clickdata(self):
>       response = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:918: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb96266240> body = '
\n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_nr_index_clickdata

test_http_request.py::FormRequestTest::test_from_response_nr_index_clickdata
self = 

    def test_from_response_nr_index_clickdata(self):
>       response = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:931: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb962d2ae0> body = '
\n \n \n
\n ' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_override_clickable

test_http_request.py::FormRequestTest::test_from_response_override_clickable
self = 

    def test_from_response_override_clickable(self):
>       response = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:877: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb962d0ad0> body = '
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_override_duplicate_form_key

test_http_request.py::FormRequestTest::test_from_response_override_duplicate_form_key
self = 

    def test_from_response_override_duplicate_form_key(self):
>       response = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:623: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb962d10d0> body = '
\n \n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_override_method

test_http_request.py::FormRequestTest::test_from_response_override_method
self = 

    def test_from_response_override_method(self):
>       response = _buildresponse(
            """
            
""" ) /testbed/tests/test_http_request.py:701: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb962d26f0> body = '\n
\n ' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_override_params

test_http_request.py::FormRequestTest::test_from_response_override_params
self = 

    def test_from_response_override_params(self):
>       response = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:677: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb9628c2c0> body = '
\n \n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_override_url

test_http_request.py::FormRequestTest::test_from_response_override_url
self = 

    def test_from_response_override_url(self):
>       response = _buildresponse(
            """
            
""" ) /testbed/tests/test_http_request.py:712: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb962d2810> body = '\n
\n ' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_post

test_http_request.py::FormRequestTest::test_from_response_post
self = 

    def test_from_response_post(self):
        response = _buildresponse(
            b"""
""", url="http://www.example.com/this/list.html", ) > req = self.request_class.from_response( response, formdata={"one": ["two", "three"], "six": "seven"} ) E AttributeError: type object 'FormRequest' has no attribute 'from_response' /testbed/tests/test_http_request.py:524: AttributeError

test_http_request.py::FormRequestTest::test_from_response_post_nonascii_bytes_latin1

test_http_request.py::FormRequestTest::test_from_response_post_nonascii_bytes_latin1
self = 

    def test_from_response_post_nonascii_bytes_latin1(self):
        response = _buildresponse(
            b"""
""", url="http://www.example.com/this/list.html", encoding="latin1", ) > req = self.request_class.from_response( response, formdata={"one": ["two", "three"], "six": "seven"} ) E AttributeError: type object 'FormRequest' has no attribute 'from_response' /testbed/tests/test_http_request.py:573: AttributeError

test_http_request.py::FormRequestTest::test_from_response_post_nonascii_bytes_utf8

test_http_request.py::FormRequestTest::test_from_response_post_nonascii_bytes_utf8
self = 

    def test_from_response_post_nonascii_bytes_utf8(self):
        response = _buildresponse(
            b"""
""", url="http://www.example.com/this/list.html", ) > req = self.request_class.from_response( response, formdata={"one": ["two", "three"], "six": "seven"} ) E AttributeError: type object 'FormRequest' has no attribute 'from_response' /testbed/tests/test_http_request.py:548: AttributeError

test_http_request.py::FormRequestTest::test_from_response_post_nonascii_unicode

test_http_request.py::FormRequestTest::test_from_response_post_nonascii_unicode
self = 

    def test_from_response_post_nonascii_unicode(self):
>       response = _buildresponse(
            """
""", url="http://www.example.com/this/list.html", ) /testbed/tests/test_http_request.py:589: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb9628d0a0> body = '
\n \n \n \n ' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_radio

test_http_request.py::FormRequestTest::test_from_response_radio
self = 

    def test_from_response_radio(self):
>       res = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:1140: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb9628dbe0> body = '
\n \n \n \n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_select

test_http_request.py::FormRequestTest::test_from_response_select
self = 

    def test_from_response_select(self):
>       res = _buildresponse(
            """
\n \n \n \n """ ) /testbed/tests/test_http_request.py:739: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb962d3aa0> body = '
\n \n ...dden" name="two" value="3">\n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_submit_not_first_clickable

test_http_request.py::FormRequestTest::test_from_response_submit_not_first_clickable
self = 

    def test_from_response_submit_not_first_clickable(self):
>       response = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:755: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb9628dbb0> body = '
\n \n ...dden" name="two" value="3">\n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_submit_novalue

test_http_request.py::FormRequestTest::test_from_response_submit_novalue
self = 

    def test_from_response_submit_novalue(self):
>       response = _buildresponse(
            """
Submit
""", url="http://www.example.com/this/list.html", ) /testbed/tests/test_http_request.py:1323: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb9628d250> body = '
\n \n \n Submit\n ' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_unicode_clickdata

test_http_request.py::FormRequestTest::test_from_response_unicode_clickdata
self = 

    def test_from_response_unicode_clickdata(self):
>       response = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:826: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb9628f410> body = '
\n \n ..."hidden" name="poundsign" value="£">\n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_unicode_clickdata_latin1

test_http_request.py::FormRequestTest::test_from_response_unicode_clickdata_latin1
self = 

    def test_from_response_unicode_clickdata_latin1(self):
>       response = _buildresponse(
            """
""", encoding="latin1", ) /testbed/tests/test_http_request.py:841: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb9624d4f0> body = '
\n \n ...="hidden" name="poundsign" value="£">\n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_unicode_xpath

test_http_request.py::FormRequestTest::test_from_response_unicode_xpath
self = 

    def test_from_response_unicode_xpath(self):
        response = _buildresponse(b'
') > r = self.request_class.from_response( response, formxpath="//form[@name='\u044a']" ) E AttributeError: type object 'FormRequest' has no attribute 'from_response' /testbed/tests/test_http_request.py:1267: AttributeError

test_http_request.py::FormRequestTest::test_from_response_valid_form_methods

test_http_request.py::FormRequestTest::test_from_response_valid_form_methods
self = 

    def test_from_response_valid_form_methods(self):
        form_methods = [
            [method, method] for method in self.request_class.valid_form_methods
        ]
        form_methods.append(["UNKNOWN", "GET"])

        for method, expected in form_methods:
>           response = _buildresponse(
                f'
' '' "
" ) /testbed/tests/test_http_request.py:1420: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb9624f950> body = '
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_from_response_xpath

test_http_request.py::FormRequestTest::test_from_response_xpath
self = 

    def test_from_response_xpath(self):
>       response = _buildresponse(
            """
""" ) /testbed/tests/test_http_request.py:1236: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb9628ecf0> body = '
\n \n \n \n
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_headers

test_http_request.py::FormRequestTest::test_headers
self = 

    def test_headers(self):
        # Different ways of setting headers attribute
        url = "http://www.scrapy.org"
        headers = {b"Accept": "gzip", b"Custom-Header": "nothing to tell you"}
        r = self.request_class(url=url, headers=headers)
        p = self.request_class(url=url, headers=r.headers)

        self.assertEqual(r.headers, p.headers)
        self.assertFalse(r.headers is headers)
        self.assertFalse(p.headers is r.headers)

        # headers must not be unicode
        h = Headers({"key1": "val1", "key2": "val2"})
        h["newkey"] = "newval"
        for k, v in h.items():
>           self.assertIsInstance(k, bytes)
E           AssertionError: 'key1' is not an instance of 

/testbed/tests/test_http_request.py:84: AssertionError

test_http_request.py::FormRequestTest::test_html_base_form_action

test_http_request.py::FormRequestTest::test_html_base_form_action
self = 

    def test_html_base_form_action(self):
>       response = _buildresponse(
            """
            
                
                    
                
                
                    
""", url="http://a.com/", ) /testbed/tests/test_http_request.py:1363: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb9624e420> body = '\n \n \n \n \n \n \n \n ' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::FormRequestTest::test_immutable_attributes

test_http_request.py::FormRequestTest::test_immutable_attributes
self = 

    def test_immutable_attributes(self):
        r = self.request_class("http://example.com")
>       self.assertRaises(AttributeError, setattr, r, "url", "http://example2.com")

/testbed/tests/test_http_request.py:286: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def wrapper(self, value):
        private_name = f"_{name}"
        if not hasattr(self, private_name):
>           warnings.warn(f"Property {name} is deprecated.", category=warn_category, stacklevel=2)
E           TypeError: category must be a Warning subclass, not 'str'

/testbed/scrapy/http/common.py:10: TypeError

test_http_request.py::FormRequestTest::test_init

test_http_request.py::FormRequestTest::test_init
self = 

    def test_init(self):
        # Request requires url in the __init__ method
        self.assertRaises(Exception, self.request_class)

        # url argument must be basestring
        self.assertRaises(TypeError, self.request_class, 123)
        r = self.request_class("http://www.example.com")

        r = self.request_class("http://www.example.com")
        assert isinstance(r.url, str)
        self.assertEqual(r.url, "http://www.example.com")
        self.assertEqual(r.method, self.default_method)

        assert isinstance(r.headers, Headers)
        self.assertEqual(r.headers, self.default_headers)
        self.assertEqual(r.meta, self.default_meta)

        meta = {"lala": "lolo"}
        headers = {b"caca": b"coco"}
        r = self.request_class(
            "http://www.example.com", meta=meta, headers=headers, body="a body"
        )

        assert r.meta is not meta
        self.assertEqual(r.meta, meta)
        assert r.headers is not headers
>       self.assertEqual(r.headers[b"caca"], b"coco")

/testbed/tests/test_http_request.py:53: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/http/headers.py:23: in __getitem__
    return super().__getitem__(key)[-1]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = {b'caca': b'coco'}, key = b'caca'

    def __getitem__(self, key):
>       return dict.__getitem__(self, self.normkey(key))
E       KeyError: None

/testbed/scrapy/utils/datatypes.py:31: KeyError

test_http_request.py::FormRequestTest::test_multi_key_values

test_http_request.py::FormRequestTest::test_multi_key_values
self = 

    def test_multi_key_values(self):
        # using multiples values for a single key
        data = {"price": "\xa3 100", "colours": ["red", "blue", "green"]}
>       r3 = self.request_class("http://www.example.com", formdata=data)

/testbed/tests/test_http_request.py:510: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
formdata = {'colours': ['red', 'blue', 'green'], 'price': '£ 100'}
args = ('http://www.example.com',), kwargs = {'method': 'POST'}
items = dict_items([('price', '£ 100'), ('colours', ['red', 'blue', 'green'])])

    def __init__(self, *args, formdata: FormdataType=None, **kwargs) -> None:
        if formdata and kwargs.get('method') is None:
            kwargs['method'] = 'POST'
        super().__init__(*args, **kwargs)
        if formdata:
            items = formdata.items() if isinstance(formdata, dict) else formdata
>           form_query_str = _urlencode(items, self.encoding)
E           NameError: name '_urlencode' is not defined

/testbed/scrapy/http/request/form.py:31: NameError

test_http_request.py::FormRequestTest::test_spaces_in_action

test_http_request.py::FormRequestTest::test_spaces_in_action
self = 

    def test_spaces_in_action(self):
>       resp = _buildresponse('
') /testbed/tests/test_http_request.py:1381: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/tests/test_http_request.py:1433: in _buildresponse return HtmlResponse(**kwargs) /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb962d4290> body = '
' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_request.py::XmlRpcRequestTest::test_ajax_url

test_http_request.py::XmlRpcRequestTest::test_ajax_url
self = 

    def test_ajax_url(self):
        # ascii url
        r = self.request_class(url="http://www.example.com/ajax.html#!key=value")
>       self.assertEqual(
            r.url, "http://www.example.com/ajax.html?_escaped_fragment_=key%3Dvalue"
        )
E       AssertionError: 'http://www.example.com/ajax.html?_escaped_fragment_=key=value' != 'http://www.example.com/ajax.html?_escaped_fragment_=key%3Dvalue'
E       - http://www.example.com/ajax.html?_escaped_fragment_=key=value
E       ?                                                        ^
E       + http://www.example.com/ajax.html?_escaped_fragment_=key%3Dvalue
E       ?                                                        ^^^

/testbed/tests/test_http_request.py:191: AssertionError

test_http_request.py::XmlRpcRequestTest::test_from_curl

test_http_request.py::XmlRpcRequestTest::test_from_curl
self = 

    def test_from_curl(self):
        # Note: more curated tests regarding curl conversion are in
        # `test_utils_curl.py`
        curl_command = (
            "curl 'http://httpbin.org/post' -X POST -H 'Cookie: _gauges_unique"
            "_year=1; _gauges_unique=1; _gauges_unique_month=1; _gauges_unique"
            "_hour=1; _gauges_unique_day=1' -H 'Origin: http://httpbin.org' -H"
            " 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q"
            "=0.9,ru;q=0.8,es;q=0.7' -H 'Upgrade-Insecure-Requests: 1' -H 'Use"
            "r-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTM"
            "L, like Gecko) Ubuntu Chromium/62.0.3202.75 Chrome/62.0.3202.75 S"
            "afari/537.36' -H 'Content-Type: application /x-www-form-urlencode"
            "d' -H 'Accept: text/html,application/xhtml+xml,application/xml;q="
            "0.9,image/webp,image/apng,*/*;q=0.8' -H 'Cache-Control: max-age=0"
            "' -H 'Referer: http://httpbin.org/forms/post' -H 'Connection: kee"
            "p-alive' --data 'custname=John+Smith&custtel=500&custemail=jsmith"
            "%40example.org&size=small&topping=cheese&topping=onion&delivery=1"
            "2%3A15&comments=' --compressed"
        )
>       r = self.request_class.from_curl(curl_command)

/testbed/tests/test_http_request.py:356: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = 
curl_command = "curl 'http://httpbin.org/post' -X POST -H 'Cookie: _gauges_unique_year=1; _gauges_unique=1; _gauges_unique_month=1; _...el=500&custemail=jsmith%40example.org&size=small&topping=cheese&topping=onion&delivery=12%3A15&comments=' --compressed"
ignore_unknown_options = True, kwargs = {}, request_kwargs = None

    @classmethod
    def from_curl(
        cls: Type[RequestTypeVar],
        curl_command: str,
        ignore_unknown_options: bool = True,
        **kwargs,
    ) -> RequestTypeVar:
        """Create a Request object from a string containing a `cURL
        `_ command. It populates the HTTP method, the
        URL, the headers, the cookies and the body. It accepts the same
        arguments as the :class:`Request` class, taking preference and
        overriding the values of the same arguments contained in the cURL
        command.

        Unrecognized options are ignored by default. To raise an error when
        finding unknown options call this method by passing
        ``ignore_unknown_options=False``.

        .. caution:: Using :meth:`from_curl` from :class:`~scrapy.http.Request`
                     subclasses, such as :class:`~scrapy.http.JSONRequest`, or
                     :class:`~scrapy.http.XmlRpcRequest`, as well as having
                     :ref:`downloader middlewares `
                     and
                     :ref:`spider middlewares `
                     enabled, such as
                     :class:`~scrapy.downloadermiddlewares.defaultheaders.DefaultHeadersMiddleware`,
                     :class:`~scrapy.downloadermiddlewares.useragent.UserAgentMiddleware`,
                     or
                     :class:`~scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware`,
                     may modify the :class:`~scrapy.http.Request` object.

        To translate a cURL command into a Scrapy request,
        you may use `curl2scrapy `_.
        """
        request_kwargs = curl_to_request_kwargs(curl_command, ignore_unknown_options)
>       request_kwargs.update(kwargs)
E       AttributeError: 'NoneType' object has no attribute 'update'

/testbed/scrapy/http/request/__init__.py:207: AttributeError

test_http_request.py::XmlRpcRequestTest::test_from_curl_ignore_unknown_options

test_http_request.py::XmlRpcRequestTest::test_from_curl_ignore_unknown_options
self = 

    def test_from_curl_ignore_unknown_options(self):
        # By default: it works and ignores the unknown options: --foo and -z
        with warnings.catch_warnings():  # avoid warning when executing tests
            warnings.simplefilter("ignore")
>           r = self.request_class.from_curl(
                'curl -X DELETE "http://example.org" --foo -z',
            )

/testbed/tests/test_http_request.py:409: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = 
curl_command = 'curl -X DELETE "http://example.org" --foo -z'
ignore_unknown_options = True, kwargs = {}, request_kwargs = None

    @classmethod
    def from_curl(
        cls: Type[RequestTypeVar],
        curl_command: str,
        ignore_unknown_options: bool = True,
        **kwargs,
    ) -> RequestTypeVar:
        """Create a Request object from a string containing a `cURL
        `_ command. It populates the HTTP method, the
        URL, the headers, the cookies and the body. It accepts the same
        arguments as the :class:`Request` class, taking preference and
        overriding the values of the same arguments contained in the cURL
        command.

        Unrecognized options are ignored by default. To raise an error when
        finding unknown options call this method by passing
        ``ignore_unknown_options=False``.

        .. caution:: Using :meth:`from_curl` from :class:`~scrapy.http.Request`
                     subclasses, such as :class:`~scrapy.http.JSONRequest`, or
                     :class:`~scrapy.http.XmlRpcRequest`, as well as having
                     :ref:`downloader middlewares `
                     and
                     :ref:`spider middlewares `
                     enabled, such as
                     :class:`~scrapy.downloadermiddlewares.defaultheaders.DefaultHeadersMiddleware`,
                     :class:`~scrapy.downloadermiddlewares.useragent.UserAgentMiddleware`,
                     or
                     :class:`~scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware`,
                     may modify the :class:`~scrapy.http.Request` object.

        To translate a cURL command into a Scrapy request,
        you may use `curl2scrapy `_.
        """
        request_kwargs = curl_to_request_kwargs(curl_command, ignore_unknown_options)
>       request_kwargs.update(kwargs)
E       AttributeError: 'NoneType' object has no attribute 'update'

/testbed/scrapy/http/request/__init__.py:207: AttributeError

test_http_request.py::XmlRpcRequestTest::test_from_curl_with_kwargs

test_http_request.py::XmlRpcRequestTest::test_from_curl_with_kwargs
self = 

    def test_from_curl_with_kwargs(self):
>       r = self.request_class.from_curl(
            'curl -X PATCH "http://example.org"', method="POST", meta={"key": "value"}
        )

/testbed/tests/test_http_request.py:399: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = 
curl_command = 'curl -X PATCH "http://example.org"'
ignore_unknown_options = True
kwargs = {'meta': {'key': 'value'}, 'method': 'POST'}, request_kwargs = None

    @classmethod
    def from_curl(
        cls: Type[RequestTypeVar],
        curl_command: str,
        ignore_unknown_options: bool = True,
        **kwargs,
    ) -> RequestTypeVar:
        """Create a Request object from a string containing a `cURL
        `_ command. It populates the HTTP method, the
        URL, the headers, the cookies and the body. It accepts the same
        arguments as the :class:`Request` class, taking preference and
        overriding the values of the same arguments contained in the cURL
        command.

        Unrecognized options are ignored by default. To raise an error when
        finding unknown options call this method by passing
        ``ignore_unknown_options=False``.

        .. caution:: Using :meth:`from_curl` from :class:`~scrapy.http.Request`
                     subclasses, such as :class:`~scrapy.http.JSONRequest`, or
                     :class:`~scrapy.http.XmlRpcRequest`, as well as having
                     :ref:`downloader middlewares `
                     and
                     :ref:`spider middlewares `
                     enabled, such as
                     :class:`~scrapy.downloadermiddlewares.defaultheaders.DefaultHeadersMiddleware`,
                     :class:`~scrapy.downloadermiddlewares.useragent.UserAgentMiddleware`,
                     or
                     :class:`~scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware`,
                     may modify the :class:`~scrapy.http.Request` object.

        To translate a cURL command into a Scrapy request,
        you may use `curl2scrapy `_.
        """
        request_kwargs = curl_to_request_kwargs(curl_command, ignore_unknown_options)
>       request_kwargs.update(kwargs)
E       AttributeError: 'NoneType' object has no attribute 'update'

/testbed/scrapy/http/request/__init__.py:207: AttributeError

test_http_request.py::XmlRpcRequestTest::test_headers

test_http_request.py::XmlRpcRequestTest::test_headers
self = 

    def test_headers(self):
        # Different ways of setting headers attribute
        url = "http://www.scrapy.org"
        headers = {b"Accept": "gzip", b"Custom-Header": "nothing to tell you"}
        r = self.request_class(url=url, headers=headers)
        p = self.request_class(url=url, headers=r.headers)

        self.assertEqual(r.headers, p.headers)
        self.assertFalse(r.headers is headers)
        self.assertFalse(p.headers is r.headers)

        # headers must not be unicode
        h = Headers({"key1": "val1", "key2": "val2"})
        h["newkey"] = "newval"
        for k, v in h.items():
>           self.assertIsInstance(k, bytes)
E           AssertionError: 'key1' is not an instance of 

/testbed/tests/test_http_request.py:84: AssertionError

test_http_request.py::XmlRpcRequestTest::test_immutable_attributes

test_http_request.py::XmlRpcRequestTest::test_immutable_attributes
self = 

    def test_immutable_attributes(self):
        r = self.request_class("http://example.com")
>       self.assertRaises(AttributeError, setattr, r, "url", "http://example2.com")

/testbed/tests/test_http_request.py:286: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def wrapper(self, value):
        private_name = f"_{name}"
        if not hasattr(self, private_name):
>           warnings.warn(f"Property {name} is deprecated.", category=warn_category, stacklevel=2)
E           TypeError: category must be a Warning subclass, not 'str'

/testbed/scrapy/http/common.py:10: TypeError

test_http_request.py::XmlRpcRequestTest::test_init

test_http_request.py::XmlRpcRequestTest::test_init
self = 

    def test_init(self):
        # Request requires url in the __init__ method
        self.assertRaises(Exception, self.request_class)

        # url argument must be basestring
        self.assertRaises(TypeError, self.request_class, 123)
        r = self.request_class("http://www.example.com")

        r = self.request_class("http://www.example.com")
        assert isinstance(r.url, str)
        self.assertEqual(r.url, "http://www.example.com")
        self.assertEqual(r.method, self.default_method)

        assert isinstance(r.headers, Headers)
>       self.assertEqual(r.headers, self.default_headers)
E       AssertionError: {'Content-Type': 'text/xml'} != {b'Content-Type': [b'text/xml']}

/testbed/tests/test_http_request.py:41: AssertionError

test_http_request.py::XmlRpcRequestTest::test_latin1

test_http_request.py::XmlRpcRequestTest::test_latin1
self = 

    def test_latin1(self):
>       self._test_request(params=("pas£",), encoding="latin1")

/testbed/tests/test_http_request.py:1475: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_http_request.py:1454: in _test_request
    self.assertEqual(r.headers[b"Content-Type"], b"text/xml")
/testbed/scrapy/http/headers.py:23: in __getitem__
    return super().__getitem__(key)[-1]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = {'Content-Type': 'text/xml'}, key = b'Content-Type'

    def __getitem__(self, key):
>       return dict.__getitem__(self, self.normkey(key))
E       KeyError: None

/testbed/scrapy/utils/datatypes.py:31: KeyError

test_http_request.py::XmlRpcRequestTest::test_replace

test_http_request.py::XmlRpcRequestTest::test_replace
self = 

    def test_replace(self):
        """Test Request.replace() method"""
        r1 = self.request_class("http://www.example.com", method="GET")
        hdrs = Headers(r1.headers)
        hdrs[b"key"] = b"value"
        r2 = r1.replace(method="POST", body="New body", headers=hdrs)
        self.assertEqual(r1.url, r2.url)
        self.assertEqual((r1.method, r2.method), ("GET", "POST"))
        self.assertEqual((r1.body, r2.body), (b"", b"New body"))
>       self.assertEqual((r1.headers, r2.headers), (self.default_headers, hdrs))
E       AssertionError: Tuples differ: ({'Content-Type': 'text/xml'}, {'Content-Type': 'text/xml', None: None}) != ({b'Content-Type': [b'text/xml']}, {'Content-Type': 'text/xml', None: None})
E       
E       First differing element 0:
E       {'Content-Type': 'text/xml'}
E       {b'Content-Type': [b'text/xml']}
E       
E       - ({'Content-Type': 'text/xml'}, {None: None, 'Content-Type': 'text/xml'})
E       + ({b'Content-Type': [b'text/xml']}, {None: None, 'Content-Type': 'text/xml'})
E       ?   +                ++          +

/testbed/tests/test_http_request.py:266: AssertionError

test_http_request.py::XmlRpcRequestTest::test_xmlrpc_dumps

test_http_request.py::XmlRpcRequestTest::test_xmlrpc_dumps
self = 

    def test_xmlrpc_dumps(self):
>       self._test_request(params=("value",))

/testbed/tests/test_http_request.py:1466: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_http_request.py:1454: in _test_request
    self.assertEqual(r.headers[b"Content-Type"], b"text/xml")
/testbed/scrapy/http/headers.py:23: in __getitem__
    return super().__getitem__(key)[-1]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = {'Content-Type': 'text/xml'}, key = b'Content-Type'

    def __getitem__(self, key):
>       return dict.__getitem__(self, self.normkey(key))
E       KeyError: None

/testbed/scrapy/utils/datatypes.py:31: KeyError

test_http_request.py::JsonRequestTest::test_ajax_url

test_http_request.py::JsonRequestTest::test_ajax_url
self = 

    def test_ajax_url(self):
        # ascii url
        r = self.request_class(url="http://www.example.com/ajax.html#!key=value")
>       self.assertEqual(
            r.url, "http://www.example.com/ajax.html?_escaped_fragment_=key%3Dvalue"
        )
E       AssertionError: 'http://www.example.com/ajax.html?_escaped_fragment_=key=value' != 'http://www.example.com/ajax.html?_escaped_fragment_=key%3Dvalue'
E       - http://www.example.com/ajax.html?_escaped_fragment_=key=value
E       ?                                                        ^
E       + http://www.example.com/ajax.html?_escaped_fragment_=key%3Dvalue
E       ?                                                        ^^^

/testbed/tests/test_http_request.py:191: AssertionError

test_http_request.py::JsonRequestTest::test_body_none_data

test_http_request.py::JsonRequestTest::test_body_none_data
self = 

    def test_body_none_data(self):
        data = {
            "name": "value",
        }
        with warnings.catch_warnings(record=True) as _warnings:
            r7 = self.request_class(url="http://www.example.com/", body=None, data=data)
>           self.assertEqual(r7.body, to_bytes(json.dumps(data)))
E           AssertionError: b'' != b'{"name": "value"}'

/testbed/tests/test_http_request.py:1561: AssertionError

test_http_request.py::JsonRequestTest::test_copy

test_http_request.py::JsonRequestTest::test_copy
self = 

    def test_copy(self):
        """Test Request copy"""

        def somecallback():
            pass

        r1 = self.request_class(
            "http://www.example.com",
            flags=["f1", "f2"],
            callback=somecallback,
            errback=somecallback,
        )
        r1.meta["foo"] = "bar"
        r1.cb_kwargs["key"] = "value"
>       r2 = r1.copy()

/testbed/tests/test_http_request.py:214: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/http/request/__init__.py:163: in copy
    return self.replace()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = , args = ()
kwargs = {'body': b'', 'callback': .somecallback at 0x7fcb976defc0>, 'cb_kwargs': {'key': 'value'}, 'cookies': {}, ...}
x = 'dumps_kwargs'

    def replace(self, *args, **kwargs) -> "Request":
        """Create a new Request with the same attributes except for those given new values"""
        for x in self.attributes:
>           kwargs.setdefault(x, getattr(self, x))
E           AttributeError: 'JsonRequest' object has no attribute 'dumps_kwargs'. Did you mean: '_dumps_kwargs'?

/testbed/scrapy/http/request/__init__.py:168: AttributeError

test_http_request.py::JsonRequestTest::test_copy_inherited_classes

test_http_request.py::JsonRequestTest::test_copy_inherited_classes
self = 

    def test_copy_inherited_classes(self):
        """Test Request children copies preserve their class"""

        class CustomRequest(self.request_class):
            pass

        r1 = CustomRequest("http://www.example.com")
>       r2 = r1.copy()

/testbed/tests/test_http_request.py:253: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/http/request/__init__.py:163: in copy
    return self.replace()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = , args = ()
kwargs = {'body': b'', 'callback': None, 'cb_kwargs': {}, 'cookies': {}, ...}
x = 'dumps_kwargs'

    def replace(self, *args, **kwargs) -> "Request":
        """Create a new Request with the same attributes except for those given new values"""
        for x in self.attributes:
>           kwargs.setdefault(x, getattr(self, x))
E           AttributeError: 'CustomRequest' object has no attribute 'dumps_kwargs'. Did you mean: '_dumps_kwargs'?

/testbed/scrapy/http/request/__init__.py:168: AttributeError

test_http_request.py::JsonRequestTest::test_data

test_http_request.py::JsonRequestTest::test_data
self = 

    def test_data(self):
        r1 = self.request_class(url="http://www.example.com/")
        self.assertEqual(r1.body, b"")

        body = b"body"
        r2 = self.request_class(url="http://www.example.com/", body=body)
        self.assertEqual(r2.body, body)

        data = {
            "name": "value",
        }
        r3 = self.request_class(url="http://www.example.com/", data=data)
>       self.assertEqual(r3.body, to_bytes(json.dumps(data)))
E       AssertionError: b'' != b'{"name": "value"}'

/testbed/tests/test_http_request.py:1502: AssertionError

test_http_request.py::JsonRequestTest::test_dumps_kwargs

test_http_request.py::JsonRequestTest::test_dumps_kwargs
self = 

    def test_dumps_kwargs(self):
        """Test that dumps_kwargs are passed to json.dumps"""
        data = {
            "name": "value",
        }
        dumps_kwargs = {
            "ensure_ascii": True,
            "allow_nan": True,
        }
        with mock.patch("json.dumps", return_value=b"") as mock_dumps:
            self.request_class(
                url="http://www.example.com/", data=data, dumps_kwargs=dumps_kwargs
            )
>           kwargs = mock_dumps.call_args[1]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/tests/test_http_request.py:1594: TypeError

test_http_request.py::JsonRequestTest::test_dumps_sort_keys

test_http_request.py::JsonRequestTest::test_dumps_sort_keys
self = 

    def test_dumps_sort_keys(self):
        """Test that sort_keys=True is passed to json.dumps by default"""
        data = {
            "name": "value",
        }
        with mock.patch("json.dumps", return_value=b"") as mock_dumps:
            self.request_class(url="http://www.example.com/", data=data)
>           kwargs = mock_dumps.call_args[1]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/tests/test_http_request.py:1578: TypeError

test_http_request.py::JsonRequestTest::test_from_curl

test_http_request.py::JsonRequestTest::test_from_curl
self = 

    def test_from_curl(self):
        # Note: more curated tests regarding curl conversion are in
        # `test_utils_curl.py`
        curl_command = (
            "curl 'http://httpbin.org/post' -X POST -H 'Cookie: _gauges_unique"
            "_year=1; _gauges_unique=1; _gauges_unique_month=1; _gauges_unique"
            "_hour=1; _gauges_unique_day=1' -H 'Origin: http://httpbin.org' -H"
            " 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q"
            "=0.9,ru;q=0.8,es;q=0.7' -H 'Upgrade-Insecure-Requests: 1' -H 'Use"
            "r-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTM"
            "L, like Gecko) Ubuntu Chromium/62.0.3202.75 Chrome/62.0.3202.75 S"
            "afari/537.36' -H 'Content-Type: application /x-www-form-urlencode"
            "d' -H 'Accept: text/html,application/xhtml+xml,application/xml;q="
            "0.9,image/webp,image/apng,*/*;q=0.8' -H 'Cache-Control: max-age=0"
            "' -H 'Referer: http://httpbin.org/forms/post' -H 'Connection: kee"
            "p-alive' --data 'custname=John+Smith&custtel=500&custemail=jsmith"
            "%40example.org&size=small&topping=cheese&topping=onion&delivery=1"
            "2%3A15&comments=' --compressed"
        )
>       r = self.request_class.from_curl(curl_command)

/testbed/tests/test_http_request.py:356: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = 
curl_command = "curl 'http://httpbin.org/post' -X POST -H 'Cookie: _gauges_unique_year=1; _gauges_unique=1; _gauges_unique_month=1; _...el=500&custemail=jsmith%40example.org&size=small&topping=cheese&topping=onion&delivery=12%3A15&comments=' --compressed"
ignore_unknown_options = True, kwargs = {}, request_kwargs = None

    @classmethod
    def from_curl(
        cls: Type[RequestTypeVar],
        curl_command: str,
        ignore_unknown_options: bool = True,
        **kwargs,
    ) -> RequestTypeVar:
        """Create a Request object from a string containing a `cURL
        `_ command. It populates the HTTP method, the
        URL, the headers, the cookies and the body. It accepts the same
        arguments as the :class:`Request` class, taking preference and
        overriding the values of the same arguments contained in the cURL
        command.

        Unrecognized options are ignored by default. To raise an error when
        finding unknown options call this method by passing
        ``ignore_unknown_options=False``.

        .. caution:: Using :meth:`from_curl` from :class:`~scrapy.http.Request`
                     subclasses, such as :class:`~scrapy.http.JSONRequest`, or
                     :class:`~scrapy.http.XmlRpcRequest`, as well as having
                     :ref:`downloader middlewares `
                     and
                     :ref:`spider middlewares `
                     enabled, such as
                     :class:`~scrapy.downloadermiddlewares.defaultheaders.DefaultHeadersMiddleware`,
                     :class:`~scrapy.downloadermiddlewares.useragent.UserAgentMiddleware`,
                     or
                     :class:`~scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware`,
                     may modify the :class:`~scrapy.http.Request` object.

        To translate a cURL command into a Scrapy request,
        you may use `curl2scrapy `_.
        """
        request_kwargs = curl_to_request_kwargs(curl_command, ignore_unknown_options)
>       request_kwargs.update(kwargs)
E       AttributeError: 'NoneType' object has no attribute 'update'

/testbed/scrapy/http/request/__init__.py:207: AttributeError

test_http_request.py::JsonRequestTest::test_from_curl_ignore_unknown_options

test_http_request.py::JsonRequestTest::test_from_curl_ignore_unknown_options
self = 

    def test_from_curl_ignore_unknown_options(self):
        # By default: it works and ignores the unknown options: --foo and -z
        with warnings.catch_warnings():  # avoid warning when executing tests
            warnings.simplefilter("ignore")
>           r = self.request_class.from_curl(
                'curl -X DELETE "http://example.org" --foo -z',
            )

/testbed/tests/test_http_request.py:409: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = 
curl_command = 'curl -X DELETE "http://example.org" --foo -z'
ignore_unknown_options = True, kwargs = {}, request_kwargs = None

    @classmethod
    def from_curl(
        cls: Type[RequestTypeVar],
        curl_command: str,
        ignore_unknown_options: bool = True,
        **kwargs,
    ) -> RequestTypeVar:
        """Create a Request object from a string containing a `cURL
        `_ command. It populates the HTTP method, the
        URL, the headers, the cookies and the body. It accepts the same
        arguments as the :class:`Request` class, taking preference and
        overriding the values of the same arguments contained in the cURL
        command.

        Unrecognized options are ignored by default. To raise an error when
        finding unknown options call this method by passing
        ``ignore_unknown_options=False``.

        .. caution:: Using :meth:`from_curl` from :class:`~scrapy.http.Request`
                     subclasses, such as :class:`~scrapy.http.JSONRequest`, or
                     :class:`~scrapy.http.XmlRpcRequest`, as well as having
                     :ref:`downloader middlewares `
                     and
                     :ref:`spider middlewares `
                     enabled, such as
                     :class:`~scrapy.downloadermiddlewares.defaultheaders.DefaultHeadersMiddleware`,
                     :class:`~scrapy.downloadermiddlewares.useragent.UserAgentMiddleware`,
                     or
                     :class:`~scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware`,
                     may modify the :class:`~scrapy.http.Request` object.

        To translate a cURL command into a Scrapy request,
        you may use `curl2scrapy `_.
        """
        request_kwargs = curl_to_request_kwargs(curl_command, ignore_unknown_options)
>       request_kwargs.update(kwargs)
E       AttributeError: 'NoneType' object has no attribute 'update'

/testbed/scrapy/http/request/__init__.py:207: AttributeError

test_http_request.py::JsonRequestTest::test_from_curl_with_kwargs

test_http_request.py::JsonRequestTest::test_from_curl_with_kwargs
self = 

    def test_from_curl_with_kwargs(self):
>       r = self.request_class.from_curl(
            'curl -X PATCH "http://example.org"', method="POST", meta={"key": "value"}
        )

/testbed/tests/test_http_request.py:399: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = 
curl_command = 'curl -X PATCH "http://example.org"'
ignore_unknown_options = True
kwargs = {'meta': {'key': 'value'}, 'method': 'POST'}, request_kwargs = None

    @classmethod
    def from_curl(
        cls: Type[RequestTypeVar],
        curl_command: str,
        ignore_unknown_options: bool = True,
        **kwargs,
    ) -> RequestTypeVar:
        """Create a Request object from a string containing a `cURL
        `_ command. It populates the HTTP method, the
        URL, the headers, the cookies and the body. It accepts the same
        arguments as the :class:`Request` class, taking preference and
        overriding the values of the same arguments contained in the cURL
        command.

        Unrecognized options are ignored by default. To raise an error when
        finding unknown options call this method by passing
        ``ignore_unknown_options=False``.

        .. caution:: Using :meth:`from_curl` from :class:`~scrapy.http.Request`
                     subclasses, such as :class:`~scrapy.http.JSONRequest`, or
                     :class:`~scrapy.http.XmlRpcRequest`, as well as having
                     :ref:`downloader middlewares `
                     and
                     :ref:`spider middlewares `
                     enabled, such as
                     :class:`~scrapy.downloadermiddlewares.defaultheaders.DefaultHeadersMiddleware`,
                     :class:`~scrapy.downloadermiddlewares.useragent.UserAgentMiddleware`,
                     or
                     :class:`~scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware`,
                     may modify the :class:`~scrapy.http.Request` object.

        To translate a cURL command into a Scrapy request,
        you may use `curl2scrapy `_.
        """
        request_kwargs = curl_to_request_kwargs(curl_command, ignore_unknown_options)
>       request_kwargs.update(kwargs)
E       AttributeError: 'NoneType' object has no attribute 'update'

/testbed/scrapy/http/request/__init__.py:207: AttributeError

test_http_request.py::JsonRequestTest::test_headers

test_http_request.py::JsonRequestTest::test_headers
self = 

    def test_headers(self):
        # Different ways of setting headers attribute
        url = "http://www.scrapy.org"
        headers = {b"Accept": "gzip", b"Custom-Header": "nothing to tell you"}
        r = self.request_class(url=url, headers=headers)
        p = self.request_class(url=url, headers=r.headers)

        self.assertEqual(r.headers, p.headers)
        self.assertFalse(r.headers is headers)
        self.assertFalse(p.headers is r.headers)

        # headers must not be unicode
        h = Headers({"key1": "val1", "key2": "val2"})
        h["newkey"] = "newval"
        for k, v in h.items():
>           self.assertIsInstance(k, bytes)
E           AssertionError: 'key1' is not an instance of 

/testbed/tests/test_http_request.py:84: AssertionError

test_http_request.py::JsonRequestTest::test_immutable_attributes

test_http_request.py::JsonRequestTest::test_immutable_attributes
self = 

    def test_immutable_attributes(self):
        r = self.request_class("http://example.com")
>       self.assertRaises(AttributeError, setattr, r, "url", "http://example2.com")

/testbed/tests/test_http_request.py:286: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def wrapper(self, value):
        private_name = f"_{name}"
        if not hasattr(self, private_name):
>           warnings.warn(f"Property {name} is deprecated.", category=warn_category, stacklevel=2)
E           TypeError: category must be a Warning subclass, not 'str'

/testbed/scrapy/http/common.py:10: TypeError

test_http_request.py::JsonRequestTest::test_init

test_http_request.py::JsonRequestTest::test_init
self = 

    def test_init(self):
        # Request requires url in the __init__ method
        self.assertRaises(Exception, self.request_class)

        # url argument must be basestring
        self.assertRaises(TypeError, self.request_class, 123)
        r = self.request_class("http://www.example.com")

        r = self.request_class("http://www.example.com")
        assert isinstance(r.url, str)
        self.assertEqual(r.url, "http://www.example.com")
        self.assertEqual(r.method, self.default_method)

        assert isinstance(r.headers, Headers)
>       self.assertEqual(r.headers, self.default_headers)
E       AssertionError: {'Content-Type': 'application/json', 'Acce[49 chars].01'} != {b'Content-Type': [b'application/json'], b[57 chars]01']}

/testbed/tests/test_http_request.py:41: AssertionError

test_http_request.py::JsonRequestTest::test_replace

test_http_request.py::JsonRequestTest::test_replace
self = 

    def test_replace(self):
        """Test Request.replace() method"""
        r1 = self.request_class("http://www.example.com", method="GET")
        hdrs = Headers(r1.headers)
        hdrs[b"key"] = b"value"
>       r2 = r1.replace(method="POST", body="New body", headers=hdrs)

/testbed/tests/test_http_request.py:262: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = , args = ()
kwargs = {'body': 'New body', 'callback': None, 'cb_kwargs': {}, 'cookies': {}, ...}
x = 'dumps_kwargs'

    def replace(self, *args, **kwargs) -> "Request":
        """Create a new Request with the same attributes except for those given new values"""
        for x in self.attributes:
>           kwargs.setdefault(x, getattr(self, x))
E           AttributeError: 'JsonRequest' object has no attribute 'dumps_kwargs'. Did you mean: '_dumps_kwargs'?

/testbed/scrapy/http/request/__init__.py:168: AttributeError

test_http_request.py::JsonRequestTest::test_replace_data

test_http_request.py::JsonRequestTest::test_replace_data
self = 

    def test_replace_data(self):
        data1 = {
            "name1": "value1",
        }
        data2 = {
            "name2": "value2",
        }
        r1 = self.request_class(url="http://www.example.com/", data=data1)
>       r2 = r1.replace(data=data2)

/testbed/tests/test_http_request.py:1606: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = , args = ()
kwargs = {'body': b'', 'callback': None, 'cb_kwargs': {}, 'cookies': {}, ...}
x = 'dumps_kwargs'

    def replace(self, *args, **kwargs) -> "Request":
        """Create a new Request with the same attributes except for those given new values"""
        for x in self.attributes:
>           kwargs.setdefault(x, getattr(self, x))
E           AttributeError: 'JsonRequest' object has no attribute 'dumps_kwargs'. Did you mean: '_dumps_kwargs'?

/testbed/scrapy/http/request/__init__.py:168: AttributeError

test_http_request.py::JsonRequestTest::test_replace_dumps_kwargs

test_http_request.py::JsonRequestTest::test_replace_dumps_kwargs
self = 

    def test_replace_dumps_kwargs(self):
        """Test that dumps_kwargs are provided to json.dumps when replace is called"""
        data1 = {
            "name1": "value1",
        }
        data2 = {
            "name2": "value2",
        }
        dumps_kwargs = {
            "ensure_ascii": True,
            "allow_nan": True,
        }
        r1 = self.request_class(
            url="http://www.example.com/", data=data1, dumps_kwargs=dumps_kwargs
        )
        with mock.patch("json.dumps", return_value=b"") as mock_dumps:
>           r1.replace(data=data2)

/testbed/tests/test_http_request.py:1639: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = , args = ()
kwargs = {'body': b'', 'callback': None, 'cb_kwargs': {}, 'cookies': {}, ...}
x = 'dumps_kwargs'

    def replace(self, *args, **kwargs) -> "Request":
        """Create a new Request with the same attributes except for those given new values"""
        for x in self.attributes:
>           kwargs.setdefault(x, getattr(self, x))
E           AttributeError: 'JsonRequest' object has no attribute 'dumps_kwargs'. Did you mean: '_dumps_kwargs'?

/testbed/scrapy/http/request/__init__.py:168: AttributeError

test_http_request.py::JsonRequestTest::test_replace_sort_keys

test_http_request.py::JsonRequestTest::test_replace_sort_keys
self = 

    def test_replace_sort_keys(self):
        """Test that replace provides sort_keys=True to json.dumps"""
        data1 = {
            "name1": "value1",
        }
        data2 = {
            "name2": "value2",
        }
        r1 = self.request_class(url="http://www.example.com/", data=data1)
        with mock.patch("json.dumps", return_value=b"") as mock_dumps:
>           r1.replace(data=data2)

/testbed/tests/test_http_request.py:1619: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = , args = ()
kwargs = {'body': b'', 'callback': None, 'cb_kwargs': {}, 'cookies': {}, ...}
x = 'dumps_kwargs'

    def replace(self, *args, **kwargs) -> "Request":
        """Create a new Request with the same attributes except for those given new values"""
        for x in self.attributes:
>           kwargs.setdefault(x, getattr(self, x))
E           AttributeError: 'JsonRequest' object has no attribute 'dumps_kwargs'. Did you mean: '_dumps_kwargs'?

/testbed/scrapy/http/request/__init__.py:168: AttributeError

test_http_response.py::BaseResponseTest::test_immutable_attributes

test_http_response.py::BaseResponseTest::test_immutable_attributes
self = 

    def test_immutable_attributes(self):
        r = self.response_class("http://example.com")
>       self.assertRaises(AttributeError, setattr, r, "url", "http://example2.com")

/testbed/tests/test_http_response.py:182: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def wrapper(self, value):
        private_name = f"_{name}"
        if not hasattr(self, private_name):
>           warnings.warn(f"Property {name} is deprecated.", category=warn_category, stacklevel=2)
E           TypeError: category must be a Warning subclass, not 'str'

/testbed/scrapy/http/common.py:10: TypeError

test_http_response.py::BaseResponseTest::test_init

test_http_response.py::BaseResponseTest::test_init
self = 

    def test_init(self):
        # Response requires url in the constructor
        self.assertRaises(Exception, self.response_class)
        self.assertTrue(
            isinstance(self.response_class("http://example.com/"), self.response_class)
        )
        self.assertRaises(TypeError, self.response_class, b"http://example.com")
        self.assertRaises(
            TypeError, self.response_class, url="http://example.com", body={}
        )
        # body can be str or None
        self.assertTrue(
            isinstance(
                self.response_class("http://example.com/", body=b""),
                self.response_class,
            )
        )
        self.assertTrue(
            isinstance(
                self.response_class("http://example.com/", body=b"body"),
                self.response_class,
            )
        )
        # test presence of all optional parameters
        self.assertTrue(
            isinstance(
                self.response_class(
                    "http://example.com/", body=b"", headers={}, status=200
                ),
                self.response_class,
            )
        )

        r = self.response_class("http://www.example.com")
        assert isinstance(r.url, str)
        self.assertEqual(r.url, "http://www.example.com")
        self.assertEqual(r.status, 200)

        assert isinstance(r.headers, Headers)
        self.assertEqual(r.headers, {})

        headers = {"foo": "bar"}
        body = b"a body"
        r = self.response_class("http://www.example.com", headers=headers, body=body)

        assert r.headers is not headers
>       self.assertEqual(r.headers[b"foo"], b"bar")

/testbed/tests/test_http_response.py:74: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/http/headers.py:23: in __getitem__
    return super().__getitem__(key)[-1]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = {'foo': 'bar'}, key = b'foo'

    def __getitem__(self, key):
>       return dict.__getitem__(self, self.normkey(key))
E       KeyError: None

/testbed/scrapy/utils/datatypes.py:31: KeyError

test_http_response.py::TextResponseTest::test_bom_is_removed_from_body

test_http_response.py::TextResponseTest::test_bom_is_removed_from_body
self = 

    def test_bom_is_removed_from_body(self):
        # Inferring encoding from body also cache decoded body as sideeffect,
        # this test tries to ensure that calling response.encoding and
        # response.text in indistinct order doesn't affect final
        # response.text in indistinct order doesn't affect final
        # values for encoding and decoded body.
        url = "http://example.com"
        body = b"\xef\xbb\xbfWORD"
        headers = {"Content-type": ["text/html; charset=utf-8"]}

        # Test response without content-type and BOM encoding
        response = self.response_class(url, body=body)
>       self.assertEqual(response.encoding, "utf-8")
E       AttributeError: 'TextResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/tests/test_http_response.py:543: AttributeError

test_http_response.py::TextResponseTest::test_cache_json_response

test_http_response.py::TextResponseTest::test_cache_json_response
self = 

    def test_cache_json_response(self):
        json_valid_bodies = [b"""{"ip": "109.187.217.200"}""", b"""null"""]
        for json_body in json_valid_bodies:
            json_response = self.response_class(
                "http://www.example.com", body=json_body
            )

            with mock.patch("json.loads") as mock_json:
                for _ in range(2):
                    json_response.json()
>               mock_json.assert_called_once_with(json_body)

/testbed/tests/test_http_response.py:847: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
args = (b'{"ip": "109.187.217.200"}',), kwargs = {}
msg = "Expected 'loads' to be called once. Called 0 times."

    def assert_called_once_with(self, /, *args, **kwargs):
        """assert that the mock was called exactly once and that that call was
        with the specified arguments."""
        if not self.call_count == 1:
            msg = ("Expected '%s' to be called once. Called %s times.%s"
                   % (self._mock_name or 'mock',
                      self.call_count,
                      self._calls_repr()))
>           raise AssertionError(msg)
E           AssertionError: Expected 'loads' to be called once. Called 0 times.

/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/unittest/mock.py:958: AssertionError

test_http_response.py::TextResponseTest::test_copy

test_http_response.py::TextResponseTest::test_copy
self = 

    def test_copy(self):
        """Test Response copy"""

        r1 = self.response_class("http://www.example.com", body=b"Some body")
        r1.flags.append("cached")
>       r2 = r1.copy()

/testbed/tests/test_http_response.py:92: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/http/response/__init__.py:118: in copy
    return self.replace()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://www.example.com>, args = ()
kwargs = {'body': b'Some body', 'certificate': None, 'flags': ['cached'], 'headers': {}, ...}
x = 'encoding'

    def replace(self, *args, **kwargs):
        """Create a new Response with the same attributes except for those given new values"""
        for x in self.attributes:
>           kwargs.setdefault(x, getattr(self, x))
E           AttributeError: 'TextResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/http/response/__init__.py:123: AttributeError

test_http_response.py::TextResponseTest::test_copy_inherited_classes

test_http_response.py::TextResponseTest::test_copy_inherited_classes
self = 

    def test_copy_inherited_classes(self):
        """Test Response children copies preserve their class"""

        class CustomResponse(self.response_class):
            pass

        r1 = CustomResponse("http://www.example.com")
>       r2 = r1.copy()

/testbed/tests/test_http_response.py:142: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/http/response/__init__.py:118: in copy
    return self.replace()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://www.example.com>, args = ()
kwargs = {'body': b'', 'certificate': None, 'flags': [], 'headers': {}, ...}
x = 'encoding'

    def replace(self, *args, **kwargs):
        """Create a new Response with the same attributes except for those given new values"""
        for x in self.attributes:
>           kwargs.setdefault(x, getattr(self, x))
E           AttributeError: 'CustomResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/http/response/__init__.py:123: AttributeError

test_http_response.py::TextResponseTest::test_declared_encoding_invalid

test_http_response.py::TextResponseTest::test_declared_encoding_invalid
self = 

    def test_declared_encoding_invalid(self):
        """Check that unknown declared encodings are ignored"""
        r = self.response_class(
            "http://www.example.com",
            headers={"Content-type": ["text/html; charset=UNKNOWN"]},
            body=b"\xc2\xa3",
        )
>       self.assertEqual(r._declared_encoding(), None)
E       AttributeError: 'TextResponse' object has no attribute '_declared_encoding'

/testbed/tests/test_http_response.py:504: AttributeError

test_http_response.py::TextResponseTest::test_encoding

test_http_response.py::TextResponseTest::test_encoding
self = 

    def test_encoding(self):
        r1 = self.response_class(
            "http://www.example.com",
            body=b"\xc2\xa3",
            headers={"Content-type": ["text/html; charset=utf-8"]},
        )
>       r2 = self.response_class(
            "http://www.example.com", encoding="utf-8", body="\xa3"
        )

/testbed/tests/test_http_response.py:426: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/http/response/text.py:33: in __init__
    super().__init__(*args, **kwargs)
/testbed/scrapy/http/response/__init__.py:55: in __init__
    self._set_body(body)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'TextResponse' object has no attribute '_url'") raised in repr()] TextResponse object at 0x7fcb96c6cbf0>
body = '£'

    def _set_body(self, body):
        if body is None:
            self._body = b""
        elif not isinstance(body, bytes):
>           raise TypeError(
                "Response body must be bytes. "
                "If you want to pass unicode body use TextResponse "
                "or HtmlResponse."
            )
E           TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse.

/testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_response.py::TextResponseTest::test_follow_None_url

test_http_response.py::TextResponseTest::test_follow_None_url
self = 

    def test_follow_None_url(self):
        r = self.response_class("http://example.com")
>       self.assertRaises(ValueError, r.follow, None)
E       AssertionError: ValueError not raised by follow

/testbed/tests/test_http_response.py:219: AssertionError

test_http_response.py::TextResponseTest::test_follow_all_css

test_http_response.py::TextResponseTest::test_follow_all_css
self = 

    def test_follow_all_css(self):
        expected = [
            "http://example.com/sample3.html",
            "http://example.com/innertag.html",
        ]
        response = self._links_response()
>       extracted = [r.url for r in response.follow_all(css='a[href*="example.com"]')]
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_http_response.py:778: TypeError

test_http_response.py::TextResponseTest::test_follow_all_css_skip_invalid

test_http_response.py::TextResponseTest::test_follow_all_css_skip_invalid
self = 

    def test_follow_all_css_skip_invalid(self):
        expected = [
            "http://example.com/page/1/",
            "http://example.com/page/3/",
            "http://example.com/page/4/",
        ]
        response = self._links_response_no_href()
>       extracted1 = [r.url for r in response.follow_all(css=".pagination a")]
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_http_response.py:788: TypeError

test_http_response.py::TextResponseTest::test_follow_all_empty

test_http_response.py::TextResponseTest::test_follow_all_empty
self = 

    def test_follow_all_empty(self):
        r = self.response_class("http://example.com")
>       self.assertEqual([], list(r.follow_all([])))
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_http_response.py:277: TypeError

test_http_response.py::TextResponseTest::test_follow_all_flags

test_http_response.py::TextResponseTest::test_follow_all_flags
self = 

    def test_follow_all_flags(self):
        re = self.response_class("http://www.example.com/")
        urls = [
            "http://www.example.com/",
            "http://www.example.com/2",
            "http://www.example.com/foo",
        ]
        fol = re.follow_all(urls, flags=["cached", "allowed"])
>       for req in fol:
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_http_response.py:769: TypeError

test_http_response.py::TextResponseTest::test_follow_all_invalid

test_http_response.py::TextResponseTest::test_follow_all_invalid
self = 

    def test_follow_all_invalid(self):
        r = self.response_class("http://example.com")
        if self.response_class == Response:
            with self.assertRaises(TypeError):
                list(r.follow_all(urls=None))
            with self.assertRaises(TypeError):
                list(r.follow_all(urls=12345))
            with self.assertRaises(ValueError):
                list(r.follow_all(urls=[None]))
        else:
            with self.assertRaises(ValueError):
>               list(r.follow_all(urls=None))
E               TypeError: 'NoneType' object is not iterable

/testbed/tests/test_http_response.py:290: TypeError

test_http_response.py::TextResponseTest::test_follow_all_too_many_arguments

test_http_response.py::TextResponseTest::test_follow_all_too_many_arguments
self = 

    def test_follow_all_too_many_arguments(self):
        response = self._links_response()
>       with self.assertRaises(ValueError):
E       AssertionError: ValueError not raised

/testbed/tests/test_http_response.py:821: AssertionError

test_http_response.py::TextResponseTest::test_follow_all_xpath

test_http_response.py::TextResponseTest::test_follow_all_xpath
self = 

    def test_follow_all_xpath(self):
        expected = [
            "http://example.com/sample3.html",
            "http://example.com/innertag.html",
        ]
        response = self._links_response()
        extracted = response.follow_all(xpath='//a[contains(@href, "example.com")]')
>       self.assertEqual(expected, [r.url for r in extracted])
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_http_response.py:800: TypeError

test_http_response.py::TextResponseTest::test_follow_all_xpath_skip_invalid

test_http_response.py::TextResponseTest::test_follow_all_xpath_skip_invalid
self = 

    def test_follow_all_xpath_skip_invalid(self):
        expected = [
            "http://example.com/page/1/",
            "http://example.com/page/3/",
            "http://example.com/page/4/",
        ]
        response = self._links_response_no_href()
        extracted1 = [
>           r.url for r in response.follow_all(xpath='//div[@id="pagination"]/a')
        ]
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_http_response.py:810: TypeError

test_http_response.py::TextResponseTest::test_follow_encoding

test_http_response.py::TextResponseTest::test_follow_encoding
self = 

    def test_follow_encoding(self):
        resp1 = self.response_class(
            "http://example.com",
            encoding="utf8",
            body='click me'.encode(
                "utf8"
            ),
        )
        req = self._assert_followed_url(
>           resp1.css("a")[0],
            "http://example.com/foo?%D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82",
            response=resp1,
        )

/testbed/tests/test_http_response.py:736: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://example.com>, a = ('a',), kw = {}

    def css(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:143: NotSupported

test_http_response.py::TextResponseTest::test_follow_flags

test_http_response.py::TextResponseTest::test_follow_flags
self = 

    def test_follow_flags(self):
        res = self.response_class("http://example.com/")
        fol = res.follow("http://example.com/", flags=["cached", "allowed"])
>       self.assertEqual(fol.flags, ["cached", "allowed"])
E       AttributeError: 'NoneType' object has no attribute 'flags'

/testbed/tests/test_http_response.py:759: AttributeError
test_http_response.py::TextResponseTest::test_follow_link
self = 

    def test_follow_link(self):
>       self._assert_followed_url(
            Link("http://example.com/foo"), "http://example.com/foo"
        )

/testbed/tests/test_http_response.py:213: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
follow_obj = Link(url='http://example.com/foo', text='', fragment='', nofollow=False)
target_url = 'http://example.com/foo', response = <200 http://example.com/index>

    def _assert_followed_url(self, follow_obj, target_url, response=None):
        if response is None:
            response = self._links_response()
        req = response.follow(follow_obj)
>       self.assertEqual(req.url, target_url)
E       AttributeError: 'NoneType' object has no attribute 'url'

/testbed/tests/test_http_response.py:332: AttributeError

test_http_response.py::TextResponseTest::test_follow_selector

test_http_response.py::TextResponseTest::test_follow_selector
self = 

    def test_follow_selector(self):
        resp = self._links_response()
        urls = [
            "http://example.com/sample2.html",
            "http://example.com/sample3.html",
            "http://example.com/sample3.html",
            "http://example.com/sample3.html",
            "http://example.com/sample3.html#foo",
            "http://www.google.com/something",
            "http://example.com/innertag.html",
        ]

        # select  elements
>       for sellist in [resp.css("a"), resp.xpath("//a")]:

/testbed/tests/test_http_response.py:669: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://example.com/index>, a = ('a',), kw = {}

    def css(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:143: NotSupported

test_http_response.py::TextResponseTest::test_follow_selector_attribute

test_http_response.py::TextResponseTest::test_follow_selector_attribute
self = 

    def test_follow_selector_attribute(self):
        resp = self._links_response()
>       for src in resp.css("img::attr(src)"):

/testbed/tests/test_http_response.py:703: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://example.com/index>, a = ('img::attr(src)',), kw = {}

    def css(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:143: NotSupported

test_http_response.py::TextResponseTest::test_follow_selector_invalid

test_http_response.py::TextResponseTest::test_follow_selector_invalid
self = 

    def test_follow_selector_invalid(self):
        resp = self._links_response()
        self.assertRaisesRegex(
            ValueError,
            "Unsupported",
            resp.follow,
>           resp.xpath("count(//div)")[0],
        )

/testbed/tests/test_http_response.py:698: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://example.com/index>, a = ('count(//div)',), kw = {}

    def xpath(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:155: NotSupported

test_http_response.py::TextResponseTest::test_follow_selector_list

test_http_response.py::TextResponseTest::test_follow_selector_list
self = 

    def test_follow_selector_list(self):
        resp = self._links_response()
>       self.assertRaisesRegex(ValueError, "SelectorList", resp.follow, resp.css("a"))

/testbed/tests/test_http_response.py:690: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://example.com/index>, a = ('a',), kw = {}

    def css(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:143: NotSupported

test_http_response.py::TextResponseTest::test_follow_selector_no_href

test_http_response.py::TextResponseTest::test_follow_selector_no_href
self = 

    def test_follow_selector_no_href(self):
        resp = self.response_class(
            url="http://example.com",
            body=b"click me",
        )
>       self.assertRaisesRegex(ValueError, "no href", resp.follow, resp.css("a")[0])

/testbed/tests/test_http_response.py:711: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://example.com>, a = ('a',), kw = {}

    def css(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:143: NotSupported

test_http_response.py::TextResponseTest::test_follow_url_absolute

test_http_response.py::TextResponseTest::test_follow_url_absolute
self = 

    def test_follow_url_absolute(self):
>       self._assert_followed_url("http://foo.example.com", "http://foo.example.com")

/testbed/tests/test_http_response.py:207: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
follow_obj = 'http://foo.example.com', target_url = 'http://foo.example.com'
response = <200 http://example.com/index>

    def _assert_followed_url(self, follow_obj, target_url, response=None):
        if response is None:
            response = self._links_response()
        req = response.follow(follow_obj)
>       self.assertEqual(req.url, target_url)
E       AttributeError: 'NoneType' object has no attribute 'url'

/testbed/tests/test_http_response.py:332: AttributeError

test_http_response.py::TextResponseTest::test_follow_url_relative

test_http_response.py::TextResponseTest::test_follow_url_relative
self = 

    def test_follow_url_relative(self):
>       self._assert_followed_url("foo", "http://example.com/foo")

/testbed/tests/test_http_response.py:210: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
follow_obj = 'foo', target_url = 'http://example.com/foo'
response = <200 http://example.com/index>

    def _assert_followed_url(self, follow_obj, target_url, response=None):
        if response is None:
            response = self._links_response()
        req = response.follow(follow_obj)
>       self.assertEqual(req.url, target_url)
E       AttributeError: 'NoneType' object has no attribute 'url'

/testbed/tests/test_http_response.py:332: AttributeError
test_http_response.py::TextResponseTest::test_follow_whitespace_link
self = 

    @mark.xfail(
        parse_version(w3lib_version) < parse_version("2.1.1"),
        reason="https://github.com/scrapy/w3lib/pull/207",
        strict=True,
    )
    def test_follow_whitespace_link(self):
>       self._assert_followed_url(
            Link("http://example.com/foo "), "http://example.com/foo"
        )

/testbed/tests/test_http_response.py:235: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
follow_obj = Link(url='http://example.com/foo ', text='', fragment='', nofollow=False)
target_url = 'http://example.com/foo', response = <200 http://example.com/index>

    def _assert_followed_url(self, follow_obj, target_url, response=None):
        if response is None:
            response = self._links_response()
        req = response.follow(follow_obj)
>       self.assertEqual(req.url, target_url)
E       AttributeError: 'NoneType' object has no attribute 'url'

/testbed/tests/test_http_response.py:332: AttributeError

test_http_response.py::TextResponseTest::test_follow_whitespace_selector

test_http_response.py::TextResponseTest::test_follow_whitespace_selector
self = 

    def test_follow_whitespace_selector(self):
        resp = self.response_class(
            "http://example.com",
            body=b"""click me""",
        )
        self._assert_followed_url(
>           resp.css("a")[0], "http://example.com/foo", response=resp
        )

/testbed/tests/test_http_response.py:719: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://example.com>, a = ('a',), kw = {}

    def css(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:143: NotSupported

test_http_response.py::TextResponseTest::test_follow_whitespace_url

test_http_response.py::TextResponseTest::test_follow_whitespace_url
self = 

    @mark.xfail(
        parse_version(w3lib_version) < parse_version("2.1.1"),
        reason="https://github.com/scrapy/w3lib/pull/207",
        strict=True,
    )
    def test_follow_whitespace_url(self):
>       self._assert_followed_url("foo ", "http://example.com/foo")

/testbed/tests/test_http_response.py:227: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
follow_obj = 'foo ', target_url = 'http://example.com/foo'
response = <200 http://example.com/index>

    def _assert_followed_url(self, follow_obj, target_url, response=None):
        if response is None:
            response = self._links_response()
        req = response.follow(follow_obj)
>       self.assertEqual(req.url, target_url)
E       AttributeError: 'NoneType' object has no attribute 'url'

/testbed/tests/test_http_response.py:332: AttributeError

test_http_response.py::TextResponseTest::test_immutable_attributes

test_http_response.py::TextResponseTest::test_immutable_attributes
self = 

    def test_immutable_attributes(self):
        r = self.response_class("http://example.com")
>       self.assertRaises(AttributeError, setattr, r, "url", "http://example2.com")

/testbed/tests/test_http_response.py:182: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def wrapper(self, value):
        private_name = f"_{name}"
        if not hasattr(self, private_name):
>           warnings.warn(f"Property {name} is deprecated.", category=warn_category, stacklevel=2)
E           TypeError: category must be a Warning subclass, not 'str'

/testbed/scrapy/http/common.py:10: TypeError

test_http_response.py::TextResponseTest::test_init

test_http_response.py::TextResponseTest::test_init
self = 

    def test_init(self):
        # Response requires url in the constructor
        self.assertRaises(Exception, self.response_class)
        self.assertTrue(
            isinstance(self.response_class("http://example.com/"), self.response_class)
        )
        self.assertRaises(TypeError, self.response_class, b"http://example.com")
        self.assertRaises(
            TypeError, self.response_class, url="http://example.com", body={}
        )
        # body can be str or None
        self.assertTrue(
            isinstance(
                self.response_class("http://example.com/", body=b""),
                self.response_class,
            )
        )
        self.assertTrue(
            isinstance(
                self.response_class("http://example.com/", body=b"body"),
                self.response_class,
            )
        )
        # test presence of all optional parameters
        self.assertTrue(
            isinstance(
                self.response_class(
                    "http://example.com/", body=b"", headers={}, status=200
                ),
                self.response_class,
            )
        )

        r = self.response_class("http://www.example.com")
        assert isinstance(r.url, str)
        self.assertEqual(r.url, "http://www.example.com")
        self.assertEqual(r.status, 200)

        assert isinstance(r.headers, Headers)
        self.assertEqual(r.headers, {})

        headers = {"foo": "bar"}
        body = b"a body"
        r = self.response_class("http://www.example.com", headers=headers, body=body)

        assert r.headers is not headers
>       self.assertEqual(r.headers[b"foo"], b"bar")

/testbed/tests/test_http_response.py:74: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/http/headers.py:23: in __getitem__
    return super().__getitem__(key)[-1]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = {'foo': 'bar'}, key = b'foo'

    def __getitem__(self, key):
>       return dict.__getitem__(self, self.normkey(key))
E       KeyError: None

/testbed/scrapy/utils/datatypes.py:31: KeyError

test_http_response.py::TextResponseTest::test_invalid_utf8_encoded_body_with_valid_utf8_BOM

test_http_response.py::TextResponseTest::test_invalid_utf8_encoded_body_with_valid_utf8_BOM
self = 

    def test_invalid_utf8_encoded_body_with_valid_utf8_BOM(self):
        r6 = self.response_class(
            "http://www.example.com",
            headers={"Content-type": ["text/html; charset=utf-8"]},
            body=b"\xef\xbb\xbfWORD\xe3\xab",
        )
>       self.assertEqual(r6.encoding, "utf-8")
E       AttributeError: 'TextResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/tests/test_http_response.py:522: AttributeError

test_http_response.py::TextResponseTest::test_json_response

test_http_response.py::TextResponseTest::test_json_response
self = 

    def test_json_response(self):
        json_body = b"""{"ip": "109.187.217.200"}"""
        json_response = self.response_class("http://www.example.com", body=json_body)
>       self.assertEqual(json_response.json(), {"ip": "109.187.217.200"})
E       AssertionError: None != {'ip': '109.187.217.200'}

/testbed/tests/test_http_response.py:830: AssertionError

test_http_response.py::TextResponseTest::test_replace

test_http_response.py::TextResponseTest::test_replace
self = 

    def test_replace(self):
>       super().test_replace()

/testbed/tests/test_http_response.py:358: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_http_response.py:150: in test_replace
    r2 = r1.replace(status=301, body=b"New body", headers=hdrs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://www.example.com>, args = ()
kwargs = {'body': b'New body', 'certificate': None, 'flags': [], 'headers': {'key': 'value'}, ...}
x = 'encoding'

    def replace(self, *args, **kwargs):
        """Create a new Response with the same attributes except for those given new values"""
        for x in self.attributes:
>           kwargs.setdefault(x, getattr(self, x))
E           AttributeError: 'TextResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/http/response/__init__.py:123: AttributeError

test_http_response.py::TextResponseTest::test_replace_wrong_encoding

test_http_response.py::TextResponseTest::test_replace_wrong_encoding
self = 

    def test_replace_wrong_encoding(self):
        """Test invalid chars are replaced properly"""
        r = self.response_class(
            "http://www.example.com",
            encoding="utf-8",
            body=b"PREFIX\xe3\xabSUFFIX",
        )
        # XXX: Policy for replacing invalid chars may suffer minor variations
        # but it should always contain the unicode replacement char ('\ufffd')
>       assert "\ufffd" in r.text, repr(r.text)
E       TypeError: argument of type 'NoneType' is not iterable

/testbed/tests/test_http_response.py:568: TypeError

test_http_response.py::TextResponseTest::test_selector

test_http_response.py::TextResponseTest::test_selector
self = 

    def test_selector(self):
        body = b"Some page"
        response = self.response_class("http://www.example.com", body=body)

>       self.assertIsInstance(response.selector, Selector)
E       AttributeError: 'TextResponse' object has no attribute 'selector'

/testbed/tests/test_http_response.py:588: AttributeError

test_http_response.py::TextResponseTest::test_selector_shortcuts

test_http_response.py::TextResponseTest::test_selector_shortcuts
self = 

    def test_selector_shortcuts(self):
        body = b"Some page"
        response = self.response_class("http://www.example.com", body=body)

        self.assertEqual(
>           response.xpath("//title/text()").getall(),
            response.selector.xpath("//title/text()").getall(),
        )

/testbed/tests/test_http_response.py:604: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://www.example.com>, a = ('//title/text()',), kw = {}

    def xpath(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:155: NotSupported

test_http_response.py::TextResponseTest::test_selector_shortcuts_kwargs

test_http_response.py::TextResponseTest::test_selector_shortcuts_kwargs
self = 

    def test_selector_shortcuts_kwargs(self):
        body = b'Some page

A nice paragraph.

' response = self.response_class("http://www.example.com", body=body) self.assertEqual( > response.xpath( "normalize-space(//p[@class=$pclass])", pclass="content" ).getall(), response.xpath('normalize-space(//p[@class="content"])').getall(), ) /testbed/tests/test_http_response.py:617: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <200 http://www.example.com> a = ('normalize-space(//p[@class=$pclass])',), kw = {'pclass': 'content'} def xpath(self, *a, **kw): """Shortcut method implemented only by responses whose content is text (subclasses of TextResponse). """ > raise NotSupported("Response content isn't text") E scrapy.exceptions.NotSupported: Response content isn't text /testbed/scrapy/http/response/__init__.py:155: NotSupported

test_http_response.py::TextResponseTest::test_shortcut_attributes

test_http_response.py::TextResponseTest::test_shortcut_attributes
self = 

    def test_shortcut_attributes(self):
        r = self.response_class("http://example.com", body=b"hello")
        if self.response_class == Response:
            msg = "Response content isn't text"
            self.assertRaisesRegex(AttributeError, msg, getattr, r, "text")
            self.assertRaisesRegex(NotSupported, msg, r.css, "body")
            self.assertRaisesRegex(NotSupported, msg, r.xpath, "//body")
            self.assertRaisesRegex(NotSupported, msg, r.jmespath, "body")
        else:
            r.text
>           r.css("body")

/testbed/tests/test_http_response.py:201: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://example.com>, a = ('body',), kw = {}

    def css(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:143: NotSupported

test_http_response.py::TextResponseTest::test_unicode_body

test_http_response.py::TextResponseTest::test_unicode_body
self = 

    def test_unicode_body(self):
        unicode_string = (
            "\u043a\u0438\u0440\u0438\u043b\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0439 "
            "\u0442\u0435\u043a\u0441\u0442"
        )
        self.assertRaises(
            TypeError,
            self.response_class,
            "http://www.example.com",
            body="unicode body",
        )

        original_string = unicode_string.encode("cp1251")
        r1 = self.response_class(
            "http://www.example.com", body=original_string, encoding="cp1251"
        )

        # check response.text
>       self.assertTrue(isinstance(r1.text, str))
E       AssertionError: False is not true

/testbed/tests/test_http_response.py:417: AssertionError

test_http_response.py::TextResponseTest::test_unicode_url

test_http_response.py::TextResponseTest::test_unicode_url
self = 

    def test_unicode_url(self):
        # instantiate with unicode url without encoding (should set default encoding)
        resp = self.response_class("http://www.example.com/")
>       self._assert_response_encoding(resp, self.response_class._DEFAULT_ENCODING)

/testbed/tests/test_http_response.py:374: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
response = <200 http://www.example.com/>, encoding = 'ascii'

    def _assert_response_encoding(self, response, encoding):
>       self.assertEqual(response.encoding, resolve_encoding(encoding))
E       AttributeError: 'TextResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/tests/test_http_response.py:178: AttributeError

test_http_response.py::TextResponseTest::test_urljoin

test_http_response.py::TextResponseTest::test_urljoin
self = 

    def test_urljoin(self):
        """Test urljoin shortcut (only for existence, since behavior equals urljoin)"""
        joined = self.response_class("http://www.example.com").urljoin("/test")
        absolute = "http://www.example.com/test"
>       self.assertEqual(joined, absolute)
E       AssertionError: None != 'http://www.example.com/test'

/testbed/tests/test_http_response.py:189: AssertionError

test_http_response.py::TextResponseTest::test_urljoin_with_base_url

test_http_response.py::TextResponseTest::test_urljoin_with_base_url
self = 

    def test_urljoin_with_base_url(self):
        """Test urljoin shortcut which also evaluates base-url through get_base_url()."""
        body = b''
        joined = self.response_class("http://www.example.com", body=body).urljoin(
            "/test"
        )
        absolute = "https://example.net/test"
>       self.assertEqual(joined, absolute)
E       AssertionError: None != 'https://example.net/test'

/testbed/tests/test_http_response.py:640: AssertionError

test_http_response.py::TextResponseTest::test_utf16

test_http_response.py::TextResponseTest::test_utf16
self = 

    def test_utf16(self):
        """Test utf-16 because UnicodeDammit is known to have problems with"""
        r = self.response_class(
            "http://www.example.com",
            body=b"\xff\xfeh\x00i\x00",
            encoding="utf-16",
        )
>       self._assert_response_values(r, "utf-16", "hi")

/testbed/tests/test_http_response.py:514: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
response = <200 http://www.example.com>, encoding = 'utf-16', body = 'hi'

    def _assert_response_values(self, response, encoding, body):
        if isinstance(body, str):
            body_unicode = body
            body_bytes = body.encode(encoding)
        else:
            body_unicode = body.decode(encoding)
            body_bytes = body

        assert isinstance(response.body, bytes)
>       assert isinstance(response.text, str)
E       AssertionError

/testbed/tests/test_http_response.py:172: AssertionError

test_http_response.py::HtmlResponseTest::test_bom_is_removed_from_body

test_http_response.py::HtmlResponseTest::test_bom_is_removed_from_body
self = 

    def test_bom_is_removed_from_body(self):
        # Inferring encoding from body also cache decoded body as sideeffect,
        # this test tries to ensure that calling response.encoding and
        # response.text in indistinct order doesn't affect final
        # response.text in indistinct order doesn't affect final
        # values for encoding and decoded body.
        url = "http://example.com"
        body = b"\xef\xbb\xbfWORD"
        headers = {"Content-type": ["text/html; charset=utf-8"]}

        # Test response without content-type and BOM encoding
        response = self.response_class(url, body=body)
>       self.assertEqual(response.encoding, "utf-8")
E       AttributeError: 'HtmlResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/tests/test_http_response.py:543: AttributeError

test_http_response.py::HtmlResponseTest::test_cache_json_response

test_http_response.py::HtmlResponseTest::test_cache_json_response
self = 

    def test_cache_json_response(self):
        json_valid_bodies = [b"""{"ip": "109.187.217.200"}""", b"""null"""]
        for json_body in json_valid_bodies:
            json_response = self.response_class(
                "http://www.example.com", body=json_body
            )

            with mock.patch("json.loads") as mock_json:
                for _ in range(2):
                    json_response.json()
>               mock_json.assert_called_once_with(json_body)

/testbed/tests/test_http_response.py:847: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
args = (b'{"ip": "109.187.217.200"}',), kwargs = {}
msg = "Expected 'loads' to be called once. Called 0 times."

    def assert_called_once_with(self, /, *args, **kwargs):
        """assert that the mock was called exactly once and that that call was
        with the specified arguments."""
        if not self.call_count == 1:
            msg = ("Expected '%s' to be called once. Called %s times.%s"
                   % (self._mock_name or 'mock',
                      self.call_count,
                      self._calls_repr()))
>           raise AssertionError(msg)
E           AssertionError: Expected 'loads' to be called once. Called 0 times.

/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/unittest/mock.py:958: AssertionError

test_http_response.py::HtmlResponseTest::test_copy

test_http_response.py::HtmlResponseTest::test_copy
self = 

    def test_copy(self):
        """Test Response copy"""

        r1 = self.response_class("http://www.example.com", body=b"Some body")
        r1.flags.append("cached")
>       r2 = r1.copy()

/testbed/tests/test_http_response.py:92: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/http/response/__init__.py:118: in copy
    return self.replace()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://www.example.com>, args = ()
kwargs = {'body': b'Some body', 'certificate': None, 'flags': ['cached'], 'headers': {}, ...}
x = 'encoding'

    def replace(self, *args, **kwargs):
        """Create a new Response with the same attributes except for those given new values"""
        for x in self.attributes:
>           kwargs.setdefault(x, getattr(self, x))
E           AttributeError: 'HtmlResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/http/response/__init__.py:123: AttributeError

test_http_response.py::HtmlResponseTest::test_copy_inherited_classes

test_http_response.py::HtmlResponseTest::test_copy_inherited_classes
self = 

    def test_copy_inherited_classes(self):
        """Test Response children copies preserve their class"""

        class CustomResponse(self.response_class):
            pass

        r1 = CustomResponse("http://www.example.com")
>       r2 = r1.copy()

/testbed/tests/test_http_response.py:142: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/http/response/__init__.py:118: in copy
    return self.replace()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://www.example.com>, args = ()
kwargs = {'body': b'', 'certificate': None, 'flags': [], 'headers': {}, ...}
x = 'encoding'

    def replace(self, *args, **kwargs):
        """Create a new Response with the same attributes except for those given new values"""
        for x in self.attributes:
>           kwargs.setdefault(x, getattr(self, x))
E           AttributeError: 'CustomResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/http/response/__init__.py:123: AttributeError

test_http_response.py::HtmlResponseTest::test_declared_encoding_invalid

test_http_response.py::HtmlResponseTest::test_declared_encoding_invalid
self = 

    def test_declared_encoding_invalid(self):
        """Check that unknown declared encodings are ignored"""
        r = self.response_class(
            "http://www.example.com",
            headers={"Content-type": ["text/html; charset=UNKNOWN"]},
            body=b"\xc2\xa3",
        )
>       self.assertEqual(r._declared_encoding(), None)
E       AttributeError: 'HtmlResponse' object has no attribute '_declared_encoding'

/testbed/tests/test_http_response.py:504: AttributeError

test_http_response.py::HtmlResponseTest::test_encoding

test_http_response.py::HtmlResponseTest::test_encoding
self = 

    def test_encoding(self):
        r1 = self.response_class(
            "http://www.example.com",
            body=b"\xc2\xa3",
            headers={"Content-type": ["text/html; charset=utf-8"]},
        )
>       r2 = self.response_class(
            "http://www.example.com", encoding="utf-8", body="\xa3"
        )

/testbed/tests/test_http_response.py:426: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/http/response/text.py:33: in __init__
    super().__init__(*args, **kwargs)
/testbed/scrapy/http/response/__init__.py:55: in __init__
    self._set_body(body)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'HtmlResponse' object has no attribute '_url'") raised in repr()] HtmlResponse object at 0x7fcb961a6960>
body = '£'

    def _set_body(self, body):
        if body is None:
            self._body = b""
        elif not isinstance(body, bytes):
>           raise TypeError(
                "Response body must be bytes. "
                "If you want to pass unicode body use TextResponse "
                "or HtmlResponse."
            )
E           TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse.

/testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_response.py::HtmlResponseTest::test_follow_None_url

test_http_response.py::HtmlResponseTest::test_follow_None_url
self = 

    def test_follow_None_url(self):
        r = self.response_class("http://example.com")
>       self.assertRaises(ValueError, r.follow, None)
E       AssertionError: ValueError not raised by follow

/testbed/tests/test_http_response.py:219: AssertionError

test_http_response.py::HtmlResponseTest::test_follow_all_css

test_http_response.py::HtmlResponseTest::test_follow_all_css
self = 

    def test_follow_all_css(self):
        expected = [
            "http://example.com/sample3.html",
            "http://example.com/innertag.html",
        ]
        response = self._links_response()
>       extracted = [r.url for r in response.follow_all(css='a[href*="example.com"]')]
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_http_response.py:778: TypeError

test_http_response.py::HtmlResponseTest::test_follow_all_css_skip_invalid

test_http_response.py::HtmlResponseTest::test_follow_all_css_skip_invalid
self = 

    def test_follow_all_css_skip_invalid(self):
        expected = [
            "http://example.com/page/1/",
            "http://example.com/page/3/",
            "http://example.com/page/4/",
        ]
        response = self._links_response_no_href()
>       extracted1 = [r.url for r in response.follow_all(css=".pagination a")]
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_http_response.py:788: TypeError

test_http_response.py::HtmlResponseTest::test_follow_all_empty

test_http_response.py::HtmlResponseTest::test_follow_all_empty
self = 

    def test_follow_all_empty(self):
        r = self.response_class("http://example.com")
>       self.assertEqual([], list(r.follow_all([])))
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_http_response.py:277: TypeError

test_http_response.py::HtmlResponseTest::test_follow_all_flags

test_http_response.py::HtmlResponseTest::test_follow_all_flags
self = 

    def test_follow_all_flags(self):
        re = self.response_class("http://www.example.com/")
        urls = [
            "http://www.example.com/",
            "http://www.example.com/2",
            "http://www.example.com/foo",
        ]
        fol = re.follow_all(urls, flags=["cached", "allowed"])
>       for req in fol:
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_http_response.py:769: TypeError

test_http_response.py::HtmlResponseTest::test_follow_all_invalid

test_http_response.py::HtmlResponseTest::test_follow_all_invalid
self = 

    def test_follow_all_invalid(self):
        r = self.response_class("http://example.com")
        if self.response_class == Response:
            with self.assertRaises(TypeError):
                list(r.follow_all(urls=None))
            with self.assertRaises(TypeError):
                list(r.follow_all(urls=12345))
            with self.assertRaises(ValueError):
                list(r.follow_all(urls=[None]))
        else:
            with self.assertRaises(ValueError):
>               list(r.follow_all(urls=None))
E               TypeError: 'NoneType' object is not iterable

/testbed/tests/test_http_response.py:290: TypeError

test_http_response.py::HtmlResponseTest::test_follow_all_too_many_arguments

test_http_response.py::HtmlResponseTest::test_follow_all_too_many_arguments
self = 

    def test_follow_all_too_many_arguments(self):
        response = self._links_response()
>       with self.assertRaises(ValueError):
E       AssertionError: ValueError not raised

/testbed/tests/test_http_response.py:821: AssertionError

test_http_response.py::HtmlResponseTest::test_follow_all_xpath

test_http_response.py::HtmlResponseTest::test_follow_all_xpath
self = 

    def test_follow_all_xpath(self):
        expected = [
            "http://example.com/sample3.html",
            "http://example.com/innertag.html",
        ]
        response = self._links_response()
        extracted = response.follow_all(xpath='//a[contains(@href, "example.com")]')
>       self.assertEqual(expected, [r.url for r in extracted])
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_http_response.py:800: TypeError

test_http_response.py::HtmlResponseTest::test_follow_all_xpath_skip_invalid

test_http_response.py::HtmlResponseTest::test_follow_all_xpath_skip_invalid
self = 

    def test_follow_all_xpath_skip_invalid(self):
        expected = [
            "http://example.com/page/1/",
            "http://example.com/page/3/",
            "http://example.com/page/4/",
        ]
        response = self._links_response_no_href()
        extracted1 = [
>           r.url for r in response.follow_all(xpath='//div[@id="pagination"]/a')
        ]
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_http_response.py:810: TypeError

test_http_response.py::HtmlResponseTest::test_follow_encoding

test_http_response.py::HtmlResponseTest::test_follow_encoding
self = 

    def test_follow_encoding(self):
        resp1 = self.response_class(
            "http://example.com",
            encoding="utf8",
            body='click me'.encode(
                "utf8"
            ),
        )
        req = self._assert_followed_url(
>           resp1.css("a")[0],
            "http://example.com/foo?%D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82",
            response=resp1,
        )

/testbed/tests/test_http_response.py:736: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://example.com>, a = ('a',), kw = {}

    def css(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:143: NotSupported

test_http_response.py::HtmlResponseTest::test_follow_flags

test_http_response.py::HtmlResponseTest::test_follow_flags
self = 

    def test_follow_flags(self):
        res = self.response_class("http://example.com/")
        fol = res.follow("http://example.com/", flags=["cached", "allowed"])
>       self.assertEqual(fol.flags, ["cached", "allowed"])
E       AttributeError: 'NoneType' object has no attribute 'flags'

/testbed/tests/test_http_response.py:759: AttributeError
test_http_response.py::HtmlResponseTest::test_follow_link
self = 

    def test_follow_link(self):
>       self._assert_followed_url(
            Link("http://example.com/foo"), "http://example.com/foo"
        )

/testbed/tests/test_http_response.py:213: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
follow_obj = Link(url='http://example.com/foo', text='', fragment='', nofollow=False)
target_url = 'http://example.com/foo', response = <200 http://example.com/index>

    def _assert_followed_url(self, follow_obj, target_url, response=None):
        if response is None:
            response = self._links_response()
        req = response.follow(follow_obj)
>       self.assertEqual(req.url, target_url)
E       AttributeError: 'NoneType' object has no attribute 'url'

/testbed/tests/test_http_response.py:332: AttributeError

test_http_response.py::HtmlResponseTest::test_follow_selector

test_http_response.py::HtmlResponseTest::test_follow_selector
self = 

    def test_follow_selector(self):
        resp = self._links_response()
        urls = [
            "http://example.com/sample2.html",
            "http://example.com/sample3.html",
            "http://example.com/sample3.html",
            "http://example.com/sample3.html",
            "http://example.com/sample3.html#foo",
            "http://www.google.com/something",
            "http://example.com/innertag.html",
        ]

        # select  elements
>       for sellist in [resp.css("a"), resp.xpath("//a")]:

/testbed/tests/test_http_response.py:669: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://example.com/index>, a = ('a',), kw = {}

    def css(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:143: NotSupported

test_http_response.py::HtmlResponseTest::test_follow_selector_attribute

test_http_response.py::HtmlResponseTest::test_follow_selector_attribute
self = 

    def test_follow_selector_attribute(self):
        resp = self._links_response()
>       for src in resp.css("img::attr(src)"):

/testbed/tests/test_http_response.py:703: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://example.com/index>, a = ('img::attr(src)',), kw = {}

    def css(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:143: NotSupported

test_http_response.py::HtmlResponseTest::test_follow_selector_invalid

test_http_response.py::HtmlResponseTest::test_follow_selector_invalid
self = 

    def test_follow_selector_invalid(self):
        resp = self._links_response()
        self.assertRaisesRegex(
            ValueError,
            "Unsupported",
            resp.follow,
>           resp.xpath("count(//div)")[0],
        )

/testbed/tests/test_http_response.py:698: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://example.com/index>, a = ('count(//div)',), kw = {}

    def xpath(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:155: NotSupported

test_http_response.py::HtmlResponseTest::test_follow_selector_list

test_http_response.py::HtmlResponseTest::test_follow_selector_list
self = 

    def test_follow_selector_list(self):
        resp = self._links_response()
>       self.assertRaisesRegex(ValueError, "SelectorList", resp.follow, resp.css("a"))

/testbed/tests/test_http_response.py:690: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://example.com/index>, a = ('a',), kw = {}

    def css(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:143: NotSupported

test_http_response.py::HtmlResponseTest::test_follow_selector_no_href

test_http_response.py::HtmlResponseTest::test_follow_selector_no_href
self = 

    def test_follow_selector_no_href(self):
        resp = self.response_class(
            url="http://example.com",
            body=b"click me",
        )
>       self.assertRaisesRegex(ValueError, "no href", resp.follow, resp.css("a")[0])

/testbed/tests/test_http_response.py:711: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://example.com>, a = ('a',), kw = {}

    def css(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:143: NotSupported

test_http_response.py::HtmlResponseTest::test_follow_url_absolute

test_http_response.py::HtmlResponseTest::test_follow_url_absolute
self = 

    def test_follow_url_absolute(self):
>       self._assert_followed_url("http://foo.example.com", "http://foo.example.com")

/testbed/tests/test_http_response.py:207: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
follow_obj = 'http://foo.example.com', target_url = 'http://foo.example.com'
response = <200 http://example.com/index>

    def _assert_followed_url(self, follow_obj, target_url, response=None):
        if response is None:
            response = self._links_response()
        req = response.follow(follow_obj)
>       self.assertEqual(req.url, target_url)
E       AttributeError: 'NoneType' object has no attribute 'url'

/testbed/tests/test_http_response.py:332: AttributeError

test_http_response.py::HtmlResponseTest::test_follow_url_relative

test_http_response.py::HtmlResponseTest::test_follow_url_relative
self = 

    def test_follow_url_relative(self):
>       self._assert_followed_url("foo", "http://example.com/foo")

/testbed/tests/test_http_response.py:210: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
follow_obj = 'foo', target_url = 'http://example.com/foo'
response = <200 http://example.com/index>

    def _assert_followed_url(self, follow_obj, target_url, response=None):
        if response is None:
            response = self._links_response()
        req = response.follow(follow_obj)
>       self.assertEqual(req.url, target_url)
E       AttributeError: 'NoneType' object has no attribute 'url'

/testbed/tests/test_http_response.py:332: AttributeError
test_http_response.py::HtmlResponseTest::test_follow_whitespace_link
self = 

    @mark.xfail(
        parse_version(w3lib_version) < parse_version("2.1.1"),
        reason="https://github.com/scrapy/w3lib/pull/207",
        strict=True,
    )
    def test_follow_whitespace_link(self):
>       self._assert_followed_url(
            Link("http://example.com/foo "), "http://example.com/foo"
        )

/testbed/tests/test_http_response.py:235: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
follow_obj = Link(url='http://example.com/foo ', text='', fragment='', nofollow=False)
target_url = 'http://example.com/foo', response = <200 http://example.com/index>

    def _assert_followed_url(self, follow_obj, target_url, response=None):
        if response is None:
            response = self._links_response()
        req = response.follow(follow_obj)
>       self.assertEqual(req.url, target_url)
E       AttributeError: 'NoneType' object has no attribute 'url'

/testbed/tests/test_http_response.py:332: AttributeError

test_http_response.py::HtmlResponseTest::test_follow_whitespace_selector

test_http_response.py::HtmlResponseTest::test_follow_whitespace_selector
self = 

    def test_follow_whitespace_selector(self):
        resp = self.response_class(
            "http://example.com",
            body=b"""click me""",
        )
        self._assert_followed_url(
>           resp.css("a")[0], "http://example.com/foo", response=resp
        )

/testbed/tests/test_http_response.py:719: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://example.com>, a = ('a',), kw = {}

    def css(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:143: NotSupported

test_http_response.py::HtmlResponseTest::test_follow_whitespace_url

test_http_response.py::HtmlResponseTest::test_follow_whitespace_url
self = 

    @mark.xfail(
        parse_version(w3lib_version) < parse_version("2.1.1"),
        reason="https://github.com/scrapy/w3lib/pull/207",
        strict=True,
    )
    def test_follow_whitespace_url(self):
>       self._assert_followed_url("foo ", "http://example.com/foo")

/testbed/tests/test_http_response.py:227: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
follow_obj = 'foo ', target_url = 'http://example.com/foo'
response = <200 http://example.com/index>

    def _assert_followed_url(self, follow_obj, target_url, response=None):
        if response is None:
            response = self._links_response()
        req = response.follow(follow_obj)
>       self.assertEqual(req.url, target_url)
E       AttributeError: 'NoneType' object has no attribute 'url'

/testbed/tests/test_http_response.py:332: AttributeError

test_http_response.py::HtmlResponseTest::test_html5_meta_charset

test_http_response.py::HtmlResponseTest::test_html5_meta_charset
self = 

    def test_html5_meta_charset(self):
        body = b"""Some pagebla bla"""
        r1 = self.response_class("http://www.example.com", body=body)
>       self._assert_response_values(r1, "gb2312", body)

/testbed/tests/test_http_response.py:888: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
response = <200 http://www.example.com>, encoding = 'gb2312'
body = b'Some pagebla bla'

    def _assert_response_values(self, response, encoding, body):
        if isinstance(body, str):
            body_unicode = body
            body_bytes = body.encode(encoding)
        else:
            body_unicode = body.decode(encoding)
            body_bytes = body

        assert isinstance(response.body, bytes)
>       assert isinstance(response.text, str)
E       AssertionError

/testbed/tests/test_http_response.py:172: AssertionError

test_http_response.py::HtmlResponseTest::test_html_encoding

test_http_response.py::HtmlResponseTest::test_html_encoding
self = 

    def test_html_encoding(self):
        body = b"""Some page
        
        Price: \xa3100'
        """
        r1 = self.response_class("http://www.example.com", body=body)
>       self._assert_response_values(r1, "iso-8859-1", body)

/testbed/tests/test_http_response.py:859: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
response = <200 http://www.example.com>, encoding = 'iso-8859-1'
body = b'Some page\n        \n        Price: \xa3100\'\n        '

    def _assert_response_values(self, response, encoding, body):
        if isinstance(body, str):
            body_unicode = body
            body_bytes = body.encode(encoding)
        else:
            body_unicode = body.decode(encoding)
            body_bytes = body

        assert isinstance(response.body, bytes)
>       assert isinstance(response.text, str)
E       AssertionError

/testbed/tests/test_http_response.py:172: AssertionError

test_http_response.py::HtmlResponseTest::test_immutable_attributes

test_http_response.py::HtmlResponseTest::test_immutable_attributes
self = 

    def test_immutable_attributes(self):
        r = self.response_class("http://example.com")
>       self.assertRaises(AttributeError, setattr, r, "url", "http://example2.com")

/testbed/tests/test_http_response.py:182: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def wrapper(self, value):
        private_name = f"_{name}"
        if not hasattr(self, private_name):
>           warnings.warn(f"Property {name} is deprecated.", category=warn_category, stacklevel=2)
E           TypeError: category must be a Warning subclass, not 'str'

/testbed/scrapy/http/common.py:10: TypeError

test_http_response.py::HtmlResponseTest::test_init

test_http_response.py::HtmlResponseTest::test_init
self = 

    def test_init(self):
        # Response requires url in the constructor
        self.assertRaises(Exception, self.response_class)
        self.assertTrue(
            isinstance(self.response_class("http://example.com/"), self.response_class)
        )
        self.assertRaises(TypeError, self.response_class, b"http://example.com")
        self.assertRaises(
            TypeError, self.response_class, url="http://example.com", body={}
        )
        # body can be str or None
        self.assertTrue(
            isinstance(
                self.response_class("http://example.com/", body=b""),
                self.response_class,
            )
        )
        self.assertTrue(
            isinstance(
                self.response_class("http://example.com/", body=b"body"),
                self.response_class,
            )
        )
        # test presence of all optional parameters
        self.assertTrue(
            isinstance(
                self.response_class(
                    "http://example.com/", body=b"", headers={}, status=200
                ),
                self.response_class,
            )
        )

        r = self.response_class("http://www.example.com")
        assert isinstance(r.url, str)
        self.assertEqual(r.url, "http://www.example.com")
        self.assertEqual(r.status, 200)

        assert isinstance(r.headers, Headers)
        self.assertEqual(r.headers, {})

        headers = {"foo": "bar"}
        body = b"a body"
        r = self.response_class("http://www.example.com", headers=headers, body=body)

        assert r.headers is not headers
>       self.assertEqual(r.headers[b"foo"], b"bar")

/testbed/tests/test_http_response.py:74: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/http/headers.py:23: in __getitem__
    return super().__getitem__(key)[-1]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = {'foo': 'bar'}, key = b'foo'

    def __getitem__(self, key):
>       return dict.__getitem__(self, self.normkey(key))
E       KeyError: None

/testbed/scrapy/utils/datatypes.py:31: KeyError

test_http_response.py::HtmlResponseTest::test_invalid_utf8_encoded_body_with_valid_utf8_BOM

test_http_response.py::HtmlResponseTest::test_invalid_utf8_encoded_body_with_valid_utf8_BOM
self = 

    def test_invalid_utf8_encoded_body_with_valid_utf8_BOM(self):
        r6 = self.response_class(
            "http://www.example.com",
            headers={"Content-type": ["text/html; charset=utf-8"]},
            body=b"\xef\xbb\xbfWORD\xe3\xab",
        )
>       self.assertEqual(r6.encoding, "utf-8")
E       AttributeError: 'HtmlResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/tests/test_http_response.py:522: AttributeError

test_http_response.py::HtmlResponseTest::test_json_response

test_http_response.py::HtmlResponseTest::test_json_response
self = 

    def test_json_response(self):
        json_body = b"""{"ip": "109.187.217.200"}"""
        json_response = self.response_class("http://www.example.com", body=json_body)
>       self.assertEqual(json_response.json(), {"ip": "109.187.217.200"})
E       AssertionError: None != {'ip': '109.187.217.200'}

/testbed/tests/test_http_response.py:830: AssertionError

test_http_response.py::HtmlResponseTest::test_replace

test_http_response.py::HtmlResponseTest::test_replace
self = 

    def test_replace(self):
>       super().test_replace()

/testbed/tests/test_http_response.py:358: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_http_response.py:150: in test_replace
    r2 = r1.replace(status=301, body=b"New body", headers=hdrs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://www.example.com>, args = ()
kwargs = {'body': b'New body', 'certificate': None, 'flags': [], 'headers': {'key': 'value'}, ...}
x = 'encoding'

    def replace(self, *args, **kwargs):
        """Create a new Response with the same attributes except for those given new values"""
        for x in self.attributes:
>           kwargs.setdefault(x, getattr(self, x))
E           AttributeError: 'HtmlResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/http/response/__init__.py:123: AttributeError

test_http_response.py::HtmlResponseTest::test_replace_wrong_encoding

test_http_response.py::HtmlResponseTest::test_replace_wrong_encoding
self = 

    def test_replace_wrong_encoding(self):
        """Test invalid chars are replaced properly"""
        r = self.response_class(
            "http://www.example.com",
            encoding="utf-8",
            body=b"PREFIX\xe3\xabSUFFIX",
        )
        # XXX: Policy for replacing invalid chars may suffer minor variations
        # but it should always contain the unicode replacement char ('\ufffd')
>       assert "\ufffd" in r.text, repr(r.text)
E       TypeError: argument of type 'NoneType' is not iterable

/testbed/tests/test_http_response.py:568: TypeError

test_http_response.py::HtmlResponseTest::test_selector

test_http_response.py::HtmlResponseTest::test_selector
self = 

    def test_selector(self):
        body = b"Some page"
        response = self.response_class("http://www.example.com", body=body)

>       self.assertIsInstance(response.selector, Selector)
E       AttributeError: 'HtmlResponse' object has no attribute 'selector'

/testbed/tests/test_http_response.py:588: AttributeError

test_http_response.py::HtmlResponseTest::test_selector_shortcuts

test_http_response.py::HtmlResponseTest::test_selector_shortcuts
self = 

    def test_selector_shortcuts(self):
        body = b"Some page"
        response = self.response_class("http://www.example.com", body=body)

        self.assertEqual(
>           response.xpath("//title/text()").getall(),
            response.selector.xpath("//title/text()").getall(),
        )

/testbed/tests/test_http_response.py:604: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://www.example.com>, a = ('//title/text()',), kw = {}

    def xpath(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:155: NotSupported

test_http_response.py::HtmlResponseTest::test_selector_shortcuts_kwargs

test_http_response.py::HtmlResponseTest::test_selector_shortcuts_kwargs
self = 

    def test_selector_shortcuts_kwargs(self):
        body = b'Some page

A nice paragraph.

' response = self.response_class("http://www.example.com", body=body) self.assertEqual( > response.xpath( "normalize-space(//p[@class=$pclass])", pclass="content" ).getall(), response.xpath('normalize-space(//p[@class="content"])').getall(), ) /testbed/tests/test_http_response.py:617: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <200 http://www.example.com> a = ('normalize-space(//p[@class=$pclass])',), kw = {'pclass': 'content'} def xpath(self, *a, **kw): """Shortcut method implemented only by responses whose content is text (subclasses of TextResponse). """ > raise NotSupported("Response content isn't text") E scrapy.exceptions.NotSupported: Response content isn't text /testbed/scrapy/http/response/__init__.py:155: NotSupported

test_http_response.py::HtmlResponseTest::test_shortcut_attributes

test_http_response.py::HtmlResponseTest::test_shortcut_attributes
self = 

    def test_shortcut_attributes(self):
        r = self.response_class("http://example.com", body=b"hello")
        if self.response_class == Response:
            msg = "Response content isn't text"
            self.assertRaisesRegex(AttributeError, msg, getattr, r, "text")
            self.assertRaisesRegex(NotSupported, msg, r.css, "body")
            self.assertRaisesRegex(NotSupported, msg, r.xpath, "//body")
            self.assertRaisesRegex(NotSupported, msg, r.jmespath, "body")
        else:
            r.text
>           r.css("body")

/testbed/tests/test_http_response.py:201: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://example.com>, a = ('body',), kw = {}

    def css(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:143: NotSupported

test_http_response.py::HtmlResponseTest::test_unicode_body

test_http_response.py::HtmlResponseTest::test_unicode_body
self = 

    def test_unicode_body(self):
        unicode_string = (
            "\u043a\u0438\u0440\u0438\u043b\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0439 "
            "\u0442\u0435\u043a\u0441\u0442"
        )
        self.assertRaises(
            TypeError,
            self.response_class,
            "http://www.example.com",
            body="unicode body",
        )

        original_string = unicode_string.encode("cp1251")
        r1 = self.response_class(
            "http://www.example.com", body=original_string, encoding="cp1251"
        )

        # check response.text
>       self.assertTrue(isinstance(r1.text, str))
E       AssertionError: False is not true

/testbed/tests/test_http_response.py:417: AssertionError

test_http_response.py::HtmlResponseTest::test_unicode_url

test_http_response.py::HtmlResponseTest::test_unicode_url
self = 

    def test_unicode_url(self):
        # instantiate with unicode url without encoding (should set default encoding)
        resp = self.response_class("http://www.example.com/")
>       self._assert_response_encoding(resp, self.response_class._DEFAULT_ENCODING)

/testbed/tests/test_http_response.py:374: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
response = <200 http://www.example.com/>, encoding = 'ascii'

    def _assert_response_encoding(self, response, encoding):
>       self.assertEqual(response.encoding, resolve_encoding(encoding))
E       AttributeError: 'HtmlResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/tests/test_http_response.py:178: AttributeError

test_http_response.py::HtmlResponseTest::test_urljoin

test_http_response.py::HtmlResponseTest::test_urljoin
self = 

    def test_urljoin(self):
        """Test urljoin shortcut (only for existence, since behavior equals urljoin)"""
        joined = self.response_class("http://www.example.com").urljoin("/test")
        absolute = "http://www.example.com/test"
>       self.assertEqual(joined, absolute)
E       AssertionError: None != 'http://www.example.com/test'

/testbed/tests/test_http_response.py:189: AssertionError

test_http_response.py::HtmlResponseTest::test_urljoin_with_base_url

test_http_response.py::HtmlResponseTest::test_urljoin_with_base_url
self = 

    def test_urljoin_with_base_url(self):
        """Test urljoin shortcut which also evaluates base-url through get_base_url()."""
        body = b''
        joined = self.response_class("http://www.example.com", body=body).urljoin(
            "/test"
        )
        absolute = "https://example.net/test"
>       self.assertEqual(joined, absolute)
E       AssertionError: None != 'https://example.net/test'

/testbed/tests/test_http_response.py:640: AssertionError

test_http_response.py::HtmlResponseTest::test_utf16

test_http_response.py::HtmlResponseTest::test_utf16
self = 

    def test_utf16(self):
        """Test utf-16 because UnicodeDammit is known to have problems with"""
        r = self.response_class(
            "http://www.example.com",
            body=b"\xff\xfeh\x00i\x00",
            encoding="utf-16",
        )
>       self._assert_response_values(r, "utf-16", "hi")

/testbed/tests/test_http_response.py:514: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
response = <200 http://www.example.com>, encoding = 'utf-16', body = 'hi'

    def _assert_response_values(self, response, encoding, body):
        if isinstance(body, str):
            body_unicode = body
            body_bytes = body.encode(encoding)
        else:
            body_unicode = body.decode(encoding)
            body_bytes = body

        assert isinstance(response.body, bytes)
>       assert isinstance(response.text, str)
E       AssertionError

/testbed/tests/test_http_response.py:172: AssertionError

test_http_response.py::XmlResponseTest::test_bom_is_removed_from_body

test_http_response.py::XmlResponseTest::test_bom_is_removed_from_body
self = 

    def test_bom_is_removed_from_body(self):
        # Inferring encoding from body also cache decoded body as sideeffect,
        # this test tries to ensure that calling response.encoding and
        # response.text in indistinct order doesn't affect final
        # response.text in indistinct order doesn't affect final
        # values for encoding and decoded body.
        url = "http://example.com"
        body = b"\xef\xbb\xbfWORD"
        headers = {"Content-type": ["text/html; charset=utf-8"]}

        # Test response without content-type and BOM encoding
        response = self.response_class(url, body=body)
>       self.assertEqual(response.encoding, "utf-8")
E       AttributeError: 'XmlResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/tests/test_http_response.py:543: AttributeError

test_http_response.py::XmlResponseTest::test_cache_json_response

test_http_response.py::XmlResponseTest::test_cache_json_response
self = 

    def test_cache_json_response(self):
        json_valid_bodies = [b"""{"ip": "109.187.217.200"}""", b"""null"""]
        for json_body in json_valid_bodies:
            json_response = self.response_class(
                "http://www.example.com", body=json_body
            )

            with mock.patch("json.loads") as mock_json:
                for _ in range(2):
                    json_response.json()
>               mock_json.assert_called_once_with(json_body)

/testbed/tests/test_http_response.py:847: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
args = (b'{"ip": "109.187.217.200"}',), kwargs = {}
msg = "Expected 'loads' to be called once. Called 0 times."

    def assert_called_once_with(self, /, *args, **kwargs):
        """assert that the mock was called exactly once and that that call was
        with the specified arguments."""
        if not self.call_count == 1:
            msg = ("Expected '%s' to be called once. Called %s times.%s"
                   % (self._mock_name or 'mock',
                      self.call_count,
                      self._calls_repr()))
>           raise AssertionError(msg)
E           AssertionError: Expected 'loads' to be called once. Called 0 times.

/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/unittest/mock.py:958: AssertionError

test_http_response.py::XmlResponseTest::test_copy

test_http_response.py::XmlResponseTest::test_copy
self = 

    def test_copy(self):
        """Test Response copy"""

        r1 = self.response_class("http://www.example.com", body=b"Some body")
        r1.flags.append("cached")
>       r2 = r1.copy()

/testbed/tests/test_http_response.py:92: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/http/response/__init__.py:118: in copy
    return self.replace()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://www.example.com>, args = ()
kwargs = {'body': b'Some body', 'certificate': None, 'flags': ['cached'], 'headers': {}, ...}
x = 'encoding'

    def replace(self, *args, **kwargs):
        """Create a new Response with the same attributes except for those given new values"""
        for x in self.attributes:
>           kwargs.setdefault(x, getattr(self, x))
E           AttributeError: 'XmlResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/http/response/__init__.py:123: AttributeError

test_http_response.py::XmlResponseTest::test_copy_inherited_classes

test_http_response.py::XmlResponseTest::test_copy_inherited_classes
self = 

    def test_copy_inherited_classes(self):
        """Test Response children copies preserve their class"""

        class CustomResponse(self.response_class):
            pass

        r1 = CustomResponse("http://www.example.com")
>       r2 = r1.copy()

/testbed/tests/test_http_response.py:142: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/http/response/__init__.py:118: in copy
    return self.replace()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://www.example.com>, args = ()
kwargs = {'body': b'', 'certificate': None, 'flags': [], 'headers': {}, ...}
x = 'encoding'

    def replace(self, *args, **kwargs):
        """Create a new Response with the same attributes except for those given new values"""
        for x in self.attributes:
>           kwargs.setdefault(x, getattr(self, x))
E           AttributeError: 'CustomResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/http/response/__init__.py:123: AttributeError

test_http_response.py::XmlResponseTest::test_declared_encoding_invalid

test_http_response.py::XmlResponseTest::test_declared_encoding_invalid
self = 

    def test_declared_encoding_invalid(self):
        """Check that unknown declared encodings are ignored"""
        r = self.response_class(
            "http://www.example.com",
            headers={"Content-type": ["text/html; charset=UNKNOWN"]},
            body=b"\xc2\xa3",
        )
>       self.assertEqual(r._declared_encoding(), None)
E       AttributeError: 'XmlResponse' object has no attribute '_declared_encoding'

/testbed/tests/test_http_response.py:504: AttributeError

test_http_response.py::XmlResponseTest::test_encoding

test_http_response.py::XmlResponseTest::test_encoding
self = 

    def test_encoding(self):
        r1 = self.response_class(
            "http://www.example.com",
            body=b"\xc2\xa3",
            headers={"Content-type": ["text/html; charset=utf-8"]},
        )
>       r2 = self.response_class(
            "http://www.example.com", encoding="utf-8", body="\xa3"
        )

/testbed/tests/test_http_response.py:426: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/http/response/text.py:33: in __init__
    super().__init__(*args, **kwargs)
/testbed/scrapy/http/response/__init__.py:55: in __init__
    self._set_body(body)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'XmlResponse' object has no attribute '_url'") raised in repr()] XmlResponse object at 0x7fcb9616a7e0>
body = '£'

    def _set_body(self, body):
        if body is None:
            self._body = b""
        elif not isinstance(body, bytes):
>           raise TypeError(
                "Response body must be bytes. "
                "If you want to pass unicode body use TextResponse "
                "or HtmlResponse."
            )
E           TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse.

/testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_response.py::XmlResponseTest::test_follow_None_url

test_http_response.py::XmlResponseTest::test_follow_None_url
self = 

    def test_follow_None_url(self):
        r = self.response_class("http://example.com")
>       self.assertRaises(ValueError, r.follow, None)
E       AssertionError: ValueError not raised by follow

/testbed/tests/test_http_response.py:219: AssertionError

test_http_response.py::XmlResponseTest::test_follow_all_css

test_http_response.py::XmlResponseTest::test_follow_all_css
self = 

    def test_follow_all_css(self):
        expected = [
            "http://example.com/sample3.html",
            "http://example.com/innertag.html",
        ]
        response = self._links_response()
>       extracted = [r.url for r in response.follow_all(css='a[href*="example.com"]')]
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_http_response.py:778: TypeError

test_http_response.py::XmlResponseTest::test_follow_all_css_skip_invalid

test_http_response.py::XmlResponseTest::test_follow_all_css_skip_invalid
self = 

    def test_follow_all_css_skip_invalid(self):
        expected = [
            "http://example.com/page/1/",
            "http://example.com/page/3/",
            "http://example.com/page/4/",
        ]
        response = self._links_response_no_href()
>       extracted1 = [r.url for r in response.follow_all(css=".pagination a")]
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_http_response.py:788: TypeError

test_http_response.py::XmlResponseTest::test_follow_all_empty

test_http_response.py::XmlResponseTest::test_follow_all_empty
self = 

    def test_follow_all_empty(self):
        r = self.response_class("http://example.com")
>       self.assertEqual([], list(r.follow_all([])))
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_http_response.py:277: TypeError

test_http_response.py::XmlResponseTest::test_follow_all_flags

test_http_response.py::XmlResponseTest::test_follow_all_flags
self = 

    def test_follow_all_flags(self):
        re = self.response_class("http://www.example.com/")
        urls = [
            "http://www.example.com/",
            "http://www.example.com/2",
            "http://www.example.com/foo",
        ]
        fol = re.follow_all(urls, flags=["cached", "allowed"])
>       for req in fol:
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_http_response.py:769: TypeError

test_http_response.py::XmlResponseTest::test_follow_all_invalid

test_http_response.py::XmlResponseTest::test_follow_all_invalid
self = 

    def test_follow_all_invalid(self):
        r = self.response_class("http://example.com")
        if self.response_class == Response:
            with self.assertRaises(TypeError):
                list(r.follow_all(urls=None))
            with self.assertRaises(TypeError):
                list(r.follow_all(urls=12345))
            with self.assertRaises(ValueError):
                list(r.follow_all(urls=[None]))
        else:
            with self.assertRaises(ValueError):
>               list(r.follow_all(urls=None))
E               TypeError: 'NoneType' object is not iterable

/testbed/tests/test_http_response.py:290: TypeError

test_http_response.py::XmlResponseTest::test_follow_all_too_many_arguments

test_http_response.py::XmlResponseTest::test_follow_all_too_many_arguments
self = 

    def test_follow_all_too_many_arguments(self):
        response = self._links_response()
>       with self.assertRaises(ValueError):
E       AssertionError: ValueError not raised

/testbed/tests/test_http_response.py:821: AssertionError

test_http_response.py::XmlResponseTest::test_follow_all_xpath

test_http_response.py::XmlResponseTest::test_follow_all_xpath
self = 

    def test_follow_all_xpath(self):
        expected = [
            "http://example.com/sample3.html",
            "http://example.com/innertag.html",
        ]
        response = self._links_response()
        extracted = response.follow_all(xpath='//a[contains(@href, "example.com")]')
>       self.assertEqual(expected, [r.url for r in extracted])
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_http_response.py:800: TypeError

test_http_response.py::XmlResponseTest::test_follow_all_xpath_skip_invalid

test_http_response.py::XmlResponseTest::test_follow_all_xpath_skip_invalid
self = 

    def test_follow_all_xpath_skip_invalid(self):
        expected = [
            "http://example.com/page/1/",
            "http://example.com/page/3/",
            "http://example.com/page/4/",
        ]
        response = self._links_response_no_href()
        extracted1 = [
>           r.url for r in response.follow_all(xpath='//div[@id="pagination"]/a')
        ]
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_http_response.py:810: TypeError

test_http_response.py::XmlResponseTest::test_follow_encoding

test_http_response.py::XmlResponseTest::test_follow_encoding
self = 

    def test_follow_encoding(self):
        resp1 = self.response_class(
            "http://example.com",
            encoding="utf8",
            body='click me'.encode(
                "utf8"
            ),
        )
        req = self._assert_followed_url(
>           resp1.css("a")[0],
            "http://example.com/foo?%D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82",
            response=resp1,
        )

/testbed/tests/test_http_response.py:736: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://example.com>, a = ('a',), kw = {}

    def css(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:143: NotSupported

test_http_response.py::XmlResponseTest::test_follow_flags

test_http_response.py::XmlResponseTest::test_follow_flags
self = 

    def test_follow_flags(self):
        res = self.response_class("http://example.com/")
        fol = res.follow("http://example.com/", flags=["cached", "allowed"])
>       self.assertEqual(fol.flags, ["cached", "allowed"])
E       AttributeError: 'NoneType' object has no attribute 'flags'

/testbed/tests/test_http_response.py:759: AttributeError
test_http_response.py::XmlResponseTest::test_follow_link
self = 

    def test_follow_link(self):
>       self._assert_followed_url(
            Link("http://example.com/foo"), "http://example.com/foo"
        )

/testbed/tests/test_http_response.py:213: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
follow_obj = Link(url='http://example.com/foo', text='', fragment='', nofollow=False)
target_url = 'http://example.com/foo', response = <200 http://example.com/index>

    def _assert_followed_url(self, follow_obj, target_url, response=None):
        if response is None:
            response = self._links_response()
        req = response.follow(follow_obj)
>       self.assertEqual(req.url, target_url)
E       AttributeError: 'NoneType' object has no attribute 'url'

/testbed/tests/test_http_response.py:332: AttributeError

test_http_response.py::XmlResponseTest::test_follow_selector

test_http_response.py::XmlResponseTest::test_follow_selector
self = 

    def test_follow_selector(self):
        resp = self._links_response()
        urls = [
            "http://example.com/sample2.html",
            "http://example.com/sample3.html",
            "http://example.com/sample3.html",
            "http://example.com/sample3.html",
            "http://example.com/sample3.html#foo",
            "http://www.google.com/something",
            "http://example.com/innertag.html",
        ]

        # select  elements
>       for sellist in [resp.css("a"), resp.xpath("//a")]:

/testbed/tests/test_http_response.py:669: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://example.com/index>, a = ('a',), kw = {}

    def css(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:143: NotSupported

test_http_response.py::XmlResponseTest::test_follow_selector_attribute

test_http_response.py::XmlResponseTest::test_follow_selector_attribute
self = 

    def test_follow_selector_attribute(self):
        resp = self._links_response()
>       for src in resp.css("img::attr(src)"):

/testbed/tests/test_http_response.py:703: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://example.com/index>, a = ('img::attr(src)',), kw = {}

    def css(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:143: NotSupported

test_http_response.py::XmlResponseTest::test_follow_selector_invalid

test_http_response.py::XmlResponseTest::test_follow_selector_invalid
self = 

    def test_follow_selector_invalid(self):
        resp = self._links_response()
        self.assertRaisesRegex(
            ValueError,
            "Unsupported",
            resp.follow,
>           resp.xpath("count(//div)")[0],
        )

/testbed/tests/test_http_response.py:698: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://example.com/index>, a = ('count(//div)',), kw = {}

    def xpath(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:155: NotSupported

test_http_response.py::XmlResponseTest::test_follow_selector_list

test_http_response.py::XmlResponseTest::test_follow_selector_list
self = 

    def test_follow_selector_list(self):
        resp = self._links_response()
>       self.assertRaisesRegex(ValueError, "SelectorList", resp.follow, resp.css("a"))

/testbed/tests/test_http_response.py:690: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://example.com/index>, a = ('a',), kw = {}

    def css(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:143: NotSupported

test_http_response.py::XmlResponseTest::test_follow_selector_no_href

test_http_response.py::XmlResponseTest::test_follow_selector_no_href
self = 

    def test_follow_selector_no_href(self):
        resp = self.response_class(
            url="http://example.com",
            body=b"click me",
        )
>       self.assertRaisesRegex(ValueError, "no href", resp.follow, resp.css("a")[0])

/testbed/tests/test_http_response.py:711: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://example.com>, a = ('a',), kw = {}

    def css(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:143: NotSupported

test_http_response.py::XmlResponseTest::test_follow_url_absolute

test_http_response.py::XmlResponseTest::test_follow_url_absolute
self = 

    def test_follow_url_absolute(self):
>       self._assert_followed_url("http://foo.example.com", "http://foo.example.com")

/testbed/tests/test_http_response.py:207: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
follow_obj = 'http://foo.example.com', target_url = 'http://foo.example.com'
response = <200 http://example.com/index>

    def _assert_followed_url(self, follow_obj, target_url, response=None):
        if response is None:
            response = self._links_response()
        req = response.follow(follow_obj)
>       self.assertEqual(req.url, target_url)
E       AttributeError: 'NoneType' object has no attribute 'url'

/testbed/tests/test_http_response.py:332: AttributeError

test_http_response.py::XmlResponseTest::test_follow_url_relative

test_http_response.py::XmlResponseTest::test_follow_url_relative
self = 

    def test_follow_url_relative(self):
>       self._assert_followed_url("foo", "http://example.com/foo")

/testbed/tests/test_http_response.py:210: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
follow_obj = 'foo', target_url = 'http://example.com/foo'
response = <200 http://example.com/index>

    def _assert_followed_url(self, follow_obj, target_url, response=None):
        if response is None:
            response = self._links_response()
        req = response.follow(follow_obj)
>       self.assertEqual(req.url, target_url)
E       AttributeError: 'NoneType' object has no attribute 'url'

/testbed/tests/test_http_response.py:332: AttributeError
test_http_response.py::XmlResponseTest::test_follow_whitespace_link
self = 

    @mark.xfail(
        parse_version(w3lib_version) < parse_version("2.1.1"),
        reason="https://github.com/scrapy/w3lib/pull/207",
        strict=True,
    )
    def test_follow_whitespace_link(self):
>       self._assert_followed_url(
            Link("http://example.com/foo "), "http://example.com/foo"
        )

/testbed/tests/test_http_response.py:235: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
follow_obj = Link(url='http://example.com/foo ', text='', fragment='', nofollow=False)
target_url = 'http://example.com/foo', response = <200 http://example.com/index>

    def _assert_followed_url(self, follow_obj, target_url, response=None):
        if response is None:
            response = self._links_response()
        req = response.follow(follow_obj)
>       self.assertEqual(req.url, target_url)
E       AttributeError: 'NoneType' object has no attribute 'url'

/testbed/tests/test_http_response.py:332: AttributeError

test_http_response.py::XmlResponseTest::test_follow_whitespace_selector

test_http_response.py::XmlResponseTest::test_follow_whitespace_selector
self = 

    def test_follow_whitespace_selector(self):
        resp = self.response_class(
            "http://example.com",
            body=b"""click me""",
        )
        self._assert_followed_url(
>           resp.css("a")[0], "http://example.com/foo", response=resp
        )

/testbed/tests/test_http_response.py:719: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://example.com>, a = ('a',), kw = {}

    def css(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:143: NotSupported

test_http_response.py::XmlResponseTest::test_follow_whitespace_url

test_http_response.py::XmlResponseTest::test_follow_whitespace_url
self = 

    @mark.xfail(
        parse_version(w3lib_version) < parse_version("2.1.1"),
        reason="https://github.com/scrapy/w3lib/pull/207",
        strict=True,
    )
    def test_follow_whitespace_url(self):
>       self._assert_followed_url("foo ", "http://example.com/foo")

/testbed/tests/test_http_response.py:227: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
follow_obj = 'foo ', target_url = 'http://example.com/foo'
response = <200 http://example.com/index>

    def _assert_followed_url(self, follow_obj, target_url, response=None):
        if response is None:
            response = self._links_response()
        req = response.follow(follow_obj)
>       self.assertEqual(req.url, target_url)
E       AttributeError: 'NoneType' object has no attribute 'url'

/testbed/tests/test_http_response.py:332: AttributeError

test_http_response.py::XmlResponseTest::test_immutable_attributes

test_http_response.py::XmlResponseTest::test_immutable_attributes
self = 

    def test_immutable_attributes(self):
        r = self.response_class("http://example.com")
>       self.assertRaises(AttributeError, setattr, r, "url", "http://example2.com")

/testbed/tests/test_http_response.py:182: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def wrapper(self, value):
        private_name = f"_{name}"
        if not hasattr(self, private_name):
>           warnings.warn(f"Property {name} is deprecated.", category=warn_category, stacklevel=2)
E           TypeError: category must be a Warning subclass, not 'str'

/testbed/scrapy/http/common.py:10: TypeError

test_http_response.py::XmlResponseTest::test_init

test_http_response.py::XmlResponseTest::test_init
self = 

    def test_init(self):
        # Response requires url in the constructor
        self.assertRaises(Exception, self.response_class)
        self.assertTrue(
            isinstance(self.response_class("http://example.com/"), self.response_class)
        )
        self.assertRaises(TypeError, self.response_class, b"http://example.com")
        self.assertRaises(
            TypeError, self.response_class, url="http://example.com", body={}
        )
        # body can be str or None
        self.assertTrue(
            isinstance(
                self.response_class("http://example.com/", body=b""),
                self.response_class,
            )
        )
        self.assertTrue(
            isinstance(
                self.response_class("http://example.com/", body=b"body"),
                self.response_class,
            )
        )
        # test presence of all optional parameters
        self.assertTrue(
            isinstance(
                self.response_class(
                    "http://example.com/", body=b"", headers={}, status=200
                ),
                self.response_class,
            )
        )

        r = self.response_class("http://www.example.com")
        assert isinstance(r.url, str)
        self.assertEqual(r.url, "http://www.example.com")
        self.assertEqual(r.status, 200)

        assert isinstance(r.headers, Headers)
        self.assertEqual(r.headers, {})

        headers = {"foo": "bar"}
        body = b"a body"
        r = self.response_class("http://www.example.com", headers=headers, body=body)

        assert r.headers is not headers
>       self.assertEqual(r.headers[b"foo"], b"bar")

/testbed/tests/test_http_response.py:74: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/http/headers.py:23: in __getitem__
    return super().__getitem__(key)[-1]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = {'foo': 'bar'}, key = b'foo'

    def __getitem__(self, key):
>       return dict.__getitem__(self, self.normkey(key))
E       KeyError: None

/testbed/scrapy/utils/datatypes.py:31: KeyError

test_http_response.py::XmlResponseTest::test_invalid_utf8_encoded_body_with_valid_utf8_BOM

test_http_response.py::XmlResponseTest::test_invalid_utf8_encoded_body_with_valid_utf8_BOM
self = 

    def test_invalid_utf8_encoded_body_with_valid_utf8_BOM(self):
        r6 = self.response_class(
            "http://www.example.com",
            headers={"Content-type": ["text/html; charset=utf-8"]},
            body=b"\xef\xbb\xbfWORD\xe3\xab",
        )
>       self.assertEqual(r6.encoding, "utf-8")
E       AttributeError: 'XmlResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/tests/test_http_response.py:522: AttributeError

test_http_response.py::XmlResponseTest::test_json_response

test_http_response.py::XmlResponseTest::test_json_response
self = 

    def test_json_response(self):
        json_body = b"""{"ip": "109.187.217.200"}"""
        json_response = self.response_class("http://www.example.com", body=json_body)
>       self.assertEqual(json_response.json(), {"ip": "109.187.217.200"})
E       AssertionError: None != {'ip': '109.187.217.200'}

/testbed/tests/test_http_response.py:830: AssertionError

test_http_response.py::XmlResponseTest::test_replace

test_http_response.py::XmlResponseTest::test_replace
self = 

    def test_replace(self):
>       super().test_replace()

/testbed/tests/test_http_response.py:358: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_http_response.py:150: in test_replace
    r2 = r1.replace(status=301, body=b"New body", headers=hdrs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://www.example.com>, args = ()
kwargs = {'body': b'New body', 'certificate': None, 'flags': [], 'headers': {'key': 'value'}, ...}
x = 'encoding'

    def replace(self, *args, **kwargs):
        """Create a new Response with the same attributes except for those given new values"""
        for x in self.attributes:
>           kwargs.setdefault(x, getattr(self, x))
E           AttributeError: 'XmlResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/http/response/__init__.py:123: AttributeError

test_http_response.py::XmlResponseTest::test_replace_encoding

test_http_response.py::XmlResponseTest::test_replace_encoding
self = 

    def test_replace_encoding(self):
        # make sure replace() keeps the previous encoding unless overridden explicitly
        body = b""""""
        body2 = b""""""
        r5 = self.response_class("http://www.example.com", body=body)
>       r6 = r5.replace(body=body2)

/testbed/tests/test_http_response.py:915: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://www.example.com>, args = ()
kwargs = {'body': b'', 'certificate': None, 'flags': [], 'headers': {}, ...}
x = 'encoding'

    def replace(self, *args, **kwargs):
        """Create a new Response with the same attributes except for those given new values"""
        for x in self.attributes:
>           kwargs.setdefault(x, getattr(self, x))
E           AttributeError: 'XmlResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/http/response/__init__.py:123: AttributeError

test_http_response.py::XmlResponseTest::test_replace_wrong_encoding

test_http_response.py::XmlResponseTest::test_replace_wrong_encoding
self = 

    def test_replace_wrong_encoding(self):
        """Test invalid chars are replaced properly"""
        r = self.response_class(
            "http://www.example.com",
            encoding="utf-8",
            body=b"PREFIX\xe3\xabSUFFIX",
        )
        # XXX: Policy for replacing invalid chars may suffer minor variations
        # but it should always contain the unicode replacement char ('\ufffd')
>       assert "\ufffd" in r.text, repr(r.text)
E       TypeError: argument of type 'NoneType' is not iterable

/testbed/tests/test_http_response.py:568: TypeError

test_http_response.py::XmlResponseTest::test_selector

test_http_response.py::XmlResponseTest::test_selector
self = 

    def test_selector(self):
        body = b'value'
        response = self.response_class("http://www.example.com", body=body)

>       self.assertIsInstance(response.selector, Selector)
E       AttributeError: 'XmlResponse' object has no attribute 'selector'

/testbed/tests/test_http_response.py:925: AttributeError

test_http_response.py::XmlResponseTest::test_selector_shortcuts

test_http_response.py::XmlResponseTest::test_selector_shortcuts
self = 

    def test_selector_shortcuts(self):
        body = b'value'
        response = self.response_class("http://www.example.com", body=body)

        self.assertEqual(
>           response.xpath("//elem/text()").getall(),
            response.selector.xpath("//elem/text()").getall(),
        )

/testbed/tests/test_http_response.py:937: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://www.example.com>, a = ('//elem/text()',), kw = {}

    def xpath(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:155: NotSupported

test_http_response.py::XmlResponseTest::test_selector_shortcuts_kwargs

test_http_response.py::XmlResponseTest::test_selector_shortcuts_kwargs
self = 

    def test_selector_shortcuts_kwargs(self):
        body = b"""
        
        value
        """
        response = self.response_class("http://www.example.com", body=body)

        self.assertEqual(
>           response.xpath(
                "//s:elem/text()", namespaces={"s": "http://scrapy.org"}
            ).getall(),
            response.selector.xpath(
                "//s:elem/text()", namespaces={"s": "http://scrapy.org"}
            ).getall(),
        )

/testbed/tests/test_http_response.py:949: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://www.example.com>, a = ('//s:elem/text()',)
kw = {'namespaces': {'s': 'http://scrapy.org'}}

    def xpath(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:155: NotSupported

test_http_response.py::XmlResponseTest::test_shortcut_attributes

test_http_response.py::XmlResponseTest::test_shortcut_attributes
self = 

    def test_shortcut_attributes(self):
        r = self.response_class("http://example.com", body=b"hello")
        if self.response_class == Response:
            msg = "Response content isn't text"
            self.assertRaisesRegex(AttributeError, msg, getattr, r, "text")
            self.assertRaisesRegex(NotSupported, msg, r.css, "body")
            self.assertRaisesRegex(NotSupported, msg, r.xpath, "//body")
            self.assertRaisesRegex(NotSupported, msg, r.jmespath, "body")
        else:
            r.text
>           r.css("body")

/testbed/tests/test_http_response.py:201: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://example.com>, a = ('body',), kw = {}

    def css(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:143: NotSupported

test_http_response.py::XmlResponseTest::test_unicode_body

test_http_response.py::XmlResponseTest::test_unicode_body
self = 

    def test_unicode_body(self):
        unicode_string = (
            "\u043a\u0438\u0440\u0438\u043b\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0439 "
            "\u0442\u0435\u043a\u0441\u0442"
        )
        self.assertRaises(
            TypeError,
            self.response_class,
            "http://www.example.com",
            body="unicode body",
        )

        original_string = unicode_string.encode("cp1251")
        r1 = self.response_class(
            "http://www.example.com", body=original_string, encoding="cp1251"
        )

        # check response.text
>       self.assertTrue(isinstance(r1.text, str))
E       AssertionError: False is not true

/testbed/tests/test_http_response.py:417: AssertionError

test_http_response.py::XmlResponseTest::test_unicode_url

test_http_response.py::XmlResponseTest::test_unicode_url
self = 

    def test_unicode_url(self):
        # instantiate with unicode url without encoding (should set default encoding)
        resp = self.response_class("http://www.example.com/")
>       self._assert_response_encoding(resp, self.response_class._DEFAULT_ENCODING)

/testbed/tests/test_http_response.py:374: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
response = <200 http://www.example.com/>, encoding = 'ascii'

    def _assert_response_encoding(self, response, encoding):
>       self.assertEqual(response.encoding, resolve_encoding(encoding))
E       AttributeError: 'XmlResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/tests/test_http_response.py:178: AttributeError

test_http_response.py::XmlResponseTest::test_urljoin

test_http_response.py::XmlResponseTest::test_urljoin
self = 

    def test_urljoin(self):
        """Test urljoin shortcut (only for existence, since behavior equals urljoin)"""
        joined = self.response_class("http://www.example.com").urljoin("/test")
        absolute = "http://www.example.com/test"
>       self.assertEqual(joined, absolute)
E       AssertionError: None != 'http://www.example.com/test'

/testbed/tests/test_http_response.py:189: AssertionError

test_http_response.py::XmlResponseTest::test_urljoin_with_base_url

test_http_response.py::XmlResponseTest::test_urljoin_with_base_url
self = 

    def test_urljoin_with_base_url(self):
        """Test urljoin shortcut which also evaluates base-url through get_base_url()."""
        body = b''
        joined = self.response_class("http://www.example.com", body=body).urljoin(
            "/test"
        )
        absolute = "https://example.net/test"
>       self.assertEqual(joined, absolute)
E       AssertionError: None != 'https://example.net/test'

/testbed/tests/test_http_response.py:640: AssertionError

test_http_response.py::XmlResponseTest::test_utf16

test_http_response.py::XmlResponseTest::test_utf16
self = 

    def test_utf16(self):
        """Test utf-16 because UnicodeDammit is known to have problems with"""
        r = self.response_class(
            "http://www.example.com",
            body=b"\xff\xfeh\x00i\x00",
            encoding="utf-16",
        )
>       self._assert_response_values(r, "utf-16", "hi")

/testbed/tests/test_http_response.py:514: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
response = <200 http://www.example.com>, encoding = 'utf-16', body = 'hi'

    def _assert_response_values(self, response, encoding, body):
        if isinstance(body, str):
            body_unicode = body
            body_bytes = body.encode(encoding)
        else:
            body_unicode = body.decode(encoding)
            body_bytes = body

        assert isinstance(response.body, bytes)
>       assert isinstance(response.text, str)
E       AssertionError

/testbed/tests/test_http_response.py:172: AssertionError

test_http_response.py::XmlResponseTest::test_xml_encoding

test_http_response.py::XmlResponseTest::test_xml_encoding
self = 

    def test_xml_encoding(self):
        body = b""
        r1 = self.response_class("http://www.example.com", body=body)
>       self._assert_response_values(r1, self.response_class._DEFAULT_ENCODING, body)

/testbed/tests/test_http_response.py:897: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
response = <200 http://www.example.com>, encoding = 'ascii'
body = b''

    def _assert_response_values(self, response, encoding, body):
        if isinstance(body, str):
            body_unicode = body
            body_bytes = body.encode(encoding)
        else:
            body_unicode = body.decode(encoding)
            body_bytes = body

        assert isinstance(response.body, bytes)
>       assert isinstance(response.text, str)
E       AssertionError

/testbed/tests/test_http_response.py:172: AssertionError

test_http_response.py::CustomResponseTest::test_bom_is_removed_from_body

test_http_response.py::CustomResponseTest::test_bom_is_removed_from_body
self = 

    def test_bom_is_removed_from_body(self):
        # Inferring encoding from body also cache decoded body as sideeffect,
        # this test tries to ensure that calling response.encoding and
        # response.text in indistinct order doesn't affect final
        # response.text in indistinct order doesn't affect final
        # values for encoding and decoded body.
        url = "http://example.com"
        body = b"\xef\xbb\xbfWORD"
        headers = {"Content-type": ["text/html; charset=utf-8"]}

        # Test response without content-type and BOM encoding
        response = self.response_class(url, body=body)
>       self.assertEqual(response.encoding, "utf-8")
E       AttributeError: 'CustomResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/tests/test_http_response.py:543: AttributeError

test_http_response.py::CustomResponseTest::test_cache_json_response

test_http_response.py::CustomResponseTest::test_cache_json_response
self = 

    def test_cache_json_response(self):
        json_valid_bodies = [b"""{"ip": "109.187.217.200"}""", b"""null"""]
        for json_body in json_valid_bodies:
            json_response = self.response_class(
                "http://www.example.com", body=json_body
            )

            with mock.patch("json.loads") as mock_json:
                for _ in range(2):
                    json_response.json()
>               mock_json.assert_called_once_with(json_body)

/testbed/tests/test_http_response.py:847: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
args = (b'{"ip": "109.187.217.200"}',), kwargs = {}
msg = "Expected 'loads' to be called once. Called 0 times."

    def assert_called_once_with(self, /, *args, **kwargs):
        """assert that the mock was called exactly once and that that call was
        with the specified arguments."""
        if not self.call_count == 1:
            msg = ("Expected '%s' to be called once. Called %s times.%s"
                   % (self._mock_name or 'mock',
                      self.call_count,
                      self._calls_repr()))
>           raise AssertionError(msg)
E           AssertionError: Expected 'loads' to be called once. Called 0 times.

/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/unittest/mock.py:958: AssertionError

test_http_response.py::CustomResponseTest::test_copy

test_http_response.py::CustomResponseTest::test_copy
self = 

    def test_copy(self):
>       super().test_copy()

/testbed/tests/test_http_response.py:980: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_http_response.py:92: in test_copy
    r2 = r1.copy()
/testbed/scrapy/http/response/__init__.py:118: in copy
    return self.replace()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://www.example.com>, args = ()
kwargs = {'body': b'Some body', 'certificate': None, 'flags': ['cached'], 'headers': {}, ...}
x = 'encoding'

    def replace(self, *args, **kwargs):
        """Create a new Response with the same attributes except for those given new values"""
        for x in self.attributes:
>           kwargs.setdefault(x, getattr(self, x))
E           AttributeError: 'CustomResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/http/response/__init__.py:123: AttributeError

test_http_response.py::CustomResponseTest::test_copy_inherited_classes

test_http_response.py::CustomResponseTest::test_copy_inherited_classes
self = 

    def test_copy_inherited_classes(self):
        """Test Response children copies preserve their class"""

        class CustomResponse(self.response_class):
            pass

        r1 = CustomResponse("http://www.example.com")
>       r2 = r1.copy()

/testbed/tests/test_http_response.py:142: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/http/response/__init__.py:118: in copy
    return self.replace()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://www.example.com>, args = ()
kwargs = {'body': b'', 'certificate': None, 'flags': [], 'headers': {}, ...}
x = 'encoding'

    def replace(self, *args, **kwargs):
        """Create a new Response with the same attributes except for those given new values"""
        for x in self.attributes:
>           kwargs.setdefault(x, getattr(self, x))
E           AttributeError: 'CustomResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/http/response/__init__.py:123: AttributeError

test_http_response.py::CustomResponseTest::test_declared_encoding_invalid

test_http_response.py::CustomResponseTest::test_declared_encoding_invalid
self = 

    def test_declared_encoding_invalid(self):
        """Check that unknown declared encodings are ignored"""
        r = self.response_class(
            "http://www.example.com",
            headers={"Content-type": ["text/html; charset=UNKNOWN"]},
            body=b"\xc2\xa3",
        )
>       self.assertEqual(r._declared_encoding(), None)
E       AttributeError: 'CustomResponse' object has no attribute '_declared_encoding'

/testbed/tests/test_http_response.py:504: AttributeError

test_http_response.py::CustomResponseTest::test_encoding

test_http_response.py::CustomResponseTest::test_encoding
self = 

    def test_encoding(self):
        r1 = self.response_class(
            "http://www.example.com",
            body=b"\xc2\xa3",
            headers={"Content-type": ["text/html; charset=utf-8"]},
        )
>       r2 = self.response_class(
            "http://www.example.com", encoding="utf-8", body="\xa3"
        )

/testbed/tests/test_http_response.py:426: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_http_response.py:973: in __init__
    super().__init__(*args, **kwargs)
/testbed/scrapy/http/response/text.py:33: in __init__
    super().__init__(*args, **kwargs)
/testbed/scrapy/http/response/__init__.py:55: in __init__
    self._set_body(body)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'CustomResponse' object has no attribute '_url'") raised in repr()] CustomResponse object at 0x7fcb960b32f0>
body = '£'

    def _set_body(self, body):
        if body is None:
            self._body = b""
        elif not isinstance(body, bytes):
>           raise TypeError(
                "Response body must be bytes. "
                "If you want to pass unicode body use TextResponse "
                "or HtmlResponse."
            )
E           TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse.

/testbed/scrapy/http/response/__init__.py:103: TypeError

test_http_response.py::CustomResponseTest::test_follow_None_url

test_http_response.py::CustomResponseTest::test_follow_None_url
self = 

    def test_follow_None_url(self):
        r = self.response_class("http://example.com")
>       self.assertRaises(ValueError, r.follow, None)
E       AssertionError: ValueError not raised by follow

/testbed/tests/test_http_response.py:219: AssertionError

test_http_response.py::CustomResponseTest::test_follow_all_css

test_http_response.py::CustomResponseTest::test_follow_all_css
self = 

    def test_follow_all_css(self):
        expected = [
            "http://example.com/sample3.html",
            "http://example.com/innertag.html",
        ]
        response = self._links_response()
>       extracted = [r.url for r in response.follow_all(css='a[href*="example.com"]')]
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_http_response.py:778: TypeError

test_http_response.py::CustomResponseTest::test_follow_all_css_skip_invalid

test_http_response.py::CustomResponseTest::test_follow_all_css_skip_invalid
self = 

    def test_follow_all_css_skip_invalid(self):
        expected = [
            "http://example.com/page/1/",
            "http://example.com/page/3/",
            "http://example.com/page/4/",
        ]
        response = self._links_response_no_href()
>       extracted1 = [r.url for r in response.follow_all(css=".pagination a")]
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_http_response.py:788: TypeError

test_http_response.py::CustomResponseTest::test_follow_all_empty

test_http_response.py::CustomResponseTest::test_follow_all_empty
self = 

    def test_follow_all_empty(self):
        r = self.response_class("http://example.com")
>       self.assertEqual([], list(r.follow_all([])))
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_http_response.py:277: TypeError

test_http_response.py::CustomResponseTest::test_follow_all_flags

test_http_response.py::CustomResponseTest::test_follow_all_flags
self = 

    def test_follow_all_flags(self):
        re = self.response_class("http://www.example.com/")
        urls = [
            "http://www.example.com/",
            "http://www.example.com/2",
            "http://www.example.com/foo",
        ]
        fol = re.follow_all(urls, flags=["cached", "allowed"])
>       for req in fol:
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_http_response.py:769: TypeError

test_http_response.py::CustomResponseTest::test_follow_all_invalid

test_http_response.py::CustomResponseTest::test_follow_all_invalid
self = 

    def test_follow_all_invalid(self):
        r = self.response_class("http://example.com")
        if self.response_class == Response:
            with self.assertRaises(TypeError):
                list(r.follow_all(urls=None))
            with self.assertRaises(TypeError):
                list(r.follow_all(urls=12345))
            with self.assertRaises(ValueError):
                list(r.follow_all(urls=[None]))
        else:
            with self.assertRaises(ValueError):
>               list(r.follow_all(urls=None))
E               TypeError: 'NoneType' object is not iterable

/testbed/tests/test_http_response.py:290: TypeError

test_http_response.py::CustomResponseTest::test_follow_all_too_many_arguments

test_http_response.py::CustomResponseTest::test_follow_all_too_many_arguments
self = 

    def test_follow_all_too_many_arguments(self):
        response = self._links_response()
>       with self.assertRaises(ValueError):
E       AssertionError: ValueError not raised

/testbed/tests/test_http_response.py:821: AssertionError

test_http_response.py::CustomResponseTest::test_follow_all_xpath

test_http_response.py::CustomResponseTest::test_follow_all_xpath
self = 

    def test_follow_all_xpath(self):
        expected = [
            "http://example.com/sample3.html",
            "http://example.com/innertag.html",
        ]
        response = self._links_response()
        extracted = response.follow_all(xpath='//a[contains(@href, "example.com")]')
>       self.assertEqual(expected, [r.url for r in extracted])
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_http_response.py:800: TypeError

test_http_response.py::CustomResponseTest::test_follow_all_xpath_skip_invalid

test_http_response.py::CustomResponseTest::test_follow_all_xpath_skip_invalid
self = 

    def test_follow_all_xpath_skip_invalid(self):
        expected = [
            "http://example.com/page/1/",
            "http://example.com/page/3/",
            "http://example.com/page/4/",
        ]
        response = self._links_response_no_href()
        extracted1 = [
>           r.url for r in response.follow_all(xpath='//div[@id="pagination"]/a')
        ]
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_http_response.py:810: TypeError

test_http_response.py::CustomResponseTest::test_follow_encoding

test_http_response.py::CustomResponseTest::test_follow_encoding
self = 

    def test_follow_encoding(self):
        resp1 = self.response_class(
            "http://example.com",
            encoding="utf8",
            body='click me'.encode(
                "utf8"
            ),
        )
        req = self._assert_followed_url(
>           resp1.css("a")[0],
            "http://example.com/foo?%D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82",
            response=resp1,
        )

/testbed/tests/test_http_response.py:736: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://example.com>, a = ('a',), kw = {}

    def css(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:143: NotSupported

test_http_response.py::CustomResponseTest::test_follow_flags

test_http_response.py::CustomResponseTest::test_follow_flags
self = 

    def test_follow_flags(self):
        res = self.response_class("http://example.com/")
        fol = res.follow("http://example.com/", flags=["cached", "allowed"])
>       self.assertEqual(fol.flags, ["cached", "allowed"])
E       AttributeError: 'NoneType' object has no attribute 'flags'

/testbed/tests/test_http_response.py:759: AttributeError
test_http_response.py::CustomResponseTest::test_follow_link
self = 

    def test_follow_link(self):
>       self._assert_followed_url(
            Link("http://example.com/foo"), "http://example.com/foo"
        )

/testbed/tests/test_http_response.py:213: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
follow_obj = Link(url='http://example.com/foo', text='', fragment='', nofollow=False)
target_url = 'http://example.com/foo', response = <200 http://example.com/index>

    def _assert_followed_url(self, follow_obj, target_url, response=None):
        if response is None:
            response = self._links_response()
        req = response.follow(follow_obj)
>       self.assertEqual(req.url, target_url)
E       AttributeError: 'NoneType' object has no attribute 'url'

/testbed/tests/test_http_response.py:332: AttributeError

test_http_response.py::CustomResponseTest::test_follow_selector

test_http_response.py::CustomResponseTest::test_follow_selector
self = 

    def test_follow_selector(self):
        resp = self._links_response()
        urls = [
            "http://example.com/sample2.html",
            "http://example.com/sample3.html",
            "http://example.com/sample3.html",
            "http://example.com/sample3.html",
            "http://example.com/sample3.html#foo",
            "http://www.google.com/something",
            "http://example.com/innertag.html",
        ]

        # select  elements
>       for sellist in [resp.css("a"), resp.xpath("//a")]:

/testbed/tests/test_http_response.py:669: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://example.com/index>, a = ('a',), kw = {}

    def css(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:143: NotSupported

test_http_response.py::CustomResponseTest::test_follow_selector_attribute

test_http_response.py::CustomResponseTest::test_follow_selector_attribute
self = 

    def test_follow_selector_attribute(self):
        resp = self._links_response()
>       for src in resp.css("img::attr(src)"):

/testbed/tests/test_http_response.py:703: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://example.com/index>, a = ('img::attr(src)',), kw = {}

    def css(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:143: NotSupported

test_http_response.py::CustomResponseTest::test_follow_selector_invalid

test_http_response.py::CustomResponseTest::test_follow_selector_invalid
self = 

    def test_follow_selector_invalid(self):
        resp = self._links_response()
        self.assertRaisesRegex(
            ValueError,
            "Unsupported",
            resp.follow,
>           resp.xpath("count(//div)")[0],
        )

/testbed/tests/test_http_response.py:698: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://example.com/index>, a = ('count(//div)',), kw = {}

    def xpath(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:155: NotSupported

test_http_response.py::CustomResponseTest::test_follow_selector_list

test_http_response.py::CustomResponseTest::test_follow_selector_list
self = 

    def test_follow_selector_list(self):
        resp = self._links_response()
>       self.assertRaisesRegex(ValueError, "SelectorList", resp.follow, resp.css("a"))

/testbed/tests/test_http_response.py:690: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://example.com/index>, a = ('a',), kw = {}

    def css(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:143: NotSupported

test_http_response.py::CustomResponseTest::test_follow_selector_no_href

test_http_response.py::CustomResponseTest::test_follow_selector_no_href
self = 

    def test_follow_selector_no_href(self):
        resp = self.response_class(
            url="http://example.com",
            body=b"click me",
        )
>       self.assertRaisesRegex(ValueError, "no href", resp.follow, resp.css("a")[0])

/testbed/tests/test_http_response.py:711: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://example.com>, a = ('a',), kw = {}

    def css(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:143: NotSupported

test_http_response.py::CustomResponseTest::test_follow_url_absolute

test_http_response.py::CustomResponseTest::test_follow_url_absolute
self = 

    def test_follow_url_absolute(self):
>       self._assert_followed_url("http://foo.example.com", "http://foo.example.com")

/testbed/tests/test_http_response.py:207: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
follow_obj = 'http://foo.example.com', target_url = 'http://foo.example.com'
response = <200 http://example.com/index>

    def _assert_followed_url(self, follow_obj, target_url, response=None):
        if response is None:
            response = self._links_response()
        req = response.follow(follow_obj)
>       self.assertEqual(req.url, target_url)
E       AttributeError: 'NoneType' object has no attribute 'url'

/testbed/tests/test_http_response.py:332: AttributeError

test_http_response.py::CustomResponseTest::test_follow_url_relative

test_http_response.py::CustomResponseTest::test_follow_url_relative
self = 

    def test_follow_url_relative(self):
>       self._assert_followed_url("foo", "http://example.com/foo")

/testbed/tests/test_http_response.py:210: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
follow_obj = 'foo', target_url = 'http://example.com/foo'
response = <200 http://example.com/index>

    def _assert_followed_url(self, follow_obj, target_url, response=None):
        if response is None:
            response = self._links_response()
        req = response.follow(follow_obj)
>       self.assertEqual(req.url, target_url)
E       AttributeError: 'NoneType' object has no attribute 'url'

/testbed/tests/test_http_response.py:332: AttributeError
test_http_response.py::CustomResponseTest::test_follow_whitespace_link
self = 

    @mark.xfail(
        parse_version(w3lib_version) < parse_version("2.1.1"),
        reason="https://github.com/scrapy/w3lib/pull/207",
        strict=True,
    )
    def test_follow_whitespace_link(self):
>       self._assert_followed_url(
            Link("http://example.com/foo "), "http://example.com/foo"
        )

/testbed/tests/test_http_response.py:235: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
follow_obj = Link(url='http://example.com/foo ', text='', fragment='', nofollow=False)
target_url = 'http://example.com/foo', response = <200 http://example.com/index>

    def _assert_followed_url(self, follow_obj, target_url, response=None):
        if response is None:
            response = self._links_response()
        req = response.follow(follow_obj)
>       self.assertEqual(req.url, target_url)
E       AttributeError: 'NoneType' object has no attribute 'url'

/testbed/tests/test_http_response.py:332: AttributeError

test_http_response.py::CustomResponseTest::test_follow_whitespace_selector

test_http_response.py::CustomResponseTest::test_follow_whitespace_selector
self = 

    def test_follow_whitespace_selector(self):
        resp = self.response_class(
            "http://example.com",
            body=b"""click me""",
        )
        self._assert_followed_url(
>           resp.css("a")[0], "http://example.com/foo", response=resp
        )

/testbed/tests/test_http_response.py:719: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://example.com>, a = ('a',), kw = {}

    def css(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:143: NotSupported

test_http_response.py::CustomResponseTest::test_follow_whitespace_url

test_http_response.py::CustomResponseTest::test_follow_whitespace_url
self = 

    @mark.xfail(
        parse_version(w3lib_version) < parse_version("2.1.1"),
        reason="https://github.com/scrapy/w3lib/pull/207",
        strict=True,
    )
    def test_follow_whitespace_url(self):
>       self._assert_followed_url("foo ", "http://example.com/foo")

/testbed/tests/test_http_response.py:227: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
follow_obj = 'foo ', target_url = 'http://example.com/foo'
response = <200 http://example.com/index>

    def _assert_followed_url(self, follow_obj, target_url, response=None):
        if response is None:
            response = self._links_response()
        req = response.follow(follow_obj)
>       self.assertEqual(req.url, target_url)
E       AttributeError: 'NoneType' object has no attribute 'url'

/testbed/tests/test_http_response.py:332: AttributeError

test_http_response.py::CustomResponseTest::test_immutable_attributes

test_http_response.py::CustomResponseTest::test_immutable_attributes
self = 

    def test_immutable_attributes(self):
        r = self.response_class("http://example.com")
>       self.assertRaises(AttributeError, setattr, r, "url", "http://example2.com")

/testbed/tests/test_http_response.py:182: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def wrapper(self, value):
        private_name = f"_{name}"
        if not hasattr(self, private_name):
>           warnings.warn(f"Property {name} is deprecated.", category=warn_category, stacklevel=2)
E           TypeError: category must be a Warning subclass, not 'str'

/testbed/scrapy/http/common.py:10: TypeError

test_http_response.py::CustomResponseTest::test_init

test_http_response.py::CustomResponseTest::test_init
self = 

    def test_init(self):
        # Response requires url in the constructor
        self.assertRaises(Exception, self.response_class)
        self.assertTrue(
            isinstance(self.response_class("http://example.com/"), self.response_class)
        )
        self.assertRaises(TypeError, self.response_class, b"http://example.com")
        self.assertRaises(
            TypeError, self.response_class, url="http://example.com", body={}
        )
        # body can be str or None
        self.assertTrue(
            isinstance(
                self.response_class("http://example.com/", body=b""),
                self.response_class,
            )
        )
        self.assertTrue(
            isinstance(
                self.response_class("http://example.com/", body=b"body"),
                self.response_class,
            )
        )
        # test presence of all optional parameters
        self.assertTrue(
            isinstance(
                self.response_class(
                    "http://example.com/", body=b"", headers={}, status=200
                ),
                self.response_class,
            )
        )

        r = self.response_class("http://www.example.com")
        assert isinstance(r.url, str)
        self.assertEqual(r.url, "http://www.example.com")
        self.assertEqual(r.status, 200)

        assert isinstance(r.headers, Headers)
        self.assertEqual(r.headers, {})

        headers = {"foo": "bar"}
        body = b"a body"
        r = self.response_class("http://www.example.com", headers=headers, body=body)

        assert r.headers is not headers
>       self.assertEqual(r.headers[b"foo"], b"bar")

/testbed/tests/test_http_response.py:74: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/http/headers.py:23: in __getitem__
    return super().__getitem__(key)[-1]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = {'foo': 'bar'}, key = b'foo'

    def __getitem__(self, key):
>       return dict.__getitem__(self, self.normkey(key))
E       KeyError: None

/testbed/scrapy/utils/datatypes.py:31: KeyError

test_http_response.py::CustomResponseTest::test_invalid_utf8_encoded_body_with_valid_utf8_BOM

test_http_response.py::CustomResponseTest::test_invalid_utf8_encoded_body_with_valid_utf8_BOM
self = 

    def test_invalid_utf8_encoded_body_with_valid_utf8_BOM(self):
        r6 = self.response_class(
            "http://www.example.com",
            headers={"Content-type": ["text/html; charset=utf-8"]},
            body=b"\xef\xbb\xbfWORD\xe3\xab",
        )
>       self.assertEqual(r6.encoding, "utf-8")
E       AttributeError: 'CustomResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/tests/test_http_response.py:522: AttributeError

test_http_response.py::CustomResponseTest::test_json_response

test_http_response.py::CustomResponseTest::test_json_response
self = 

    def test_json_response(self):
        json_body = b"""{"ip": "109.187.217.200"}"""
        json_response = self.response_class("http://www.example.com", body=json_body)
>       self.assertEqual(json_response.json(), {"ip": "109.187.217.200"})
E       AssertionError: None != {'ip': '109.187.217.200'}

/testbed/tests/test_http_response.py:830: AssertionError

test_http_response.py::CustomResponseTest::test_replace

test_http_response.py::CustomResponseTest::test_replace
self = 

    def test_replace(self):
>       super().test_replace()

/testbed/tests/test_http_response.py:996: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_http_response.py:358: in test_replace
    super().test_replace()
/testbed/tests/test_http_response.py:150: in test_replace
    r2 = r1.replace(status=301, body=b"New body", headers=hdrs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://www.example.com>, args = ()
kwargs = {'body': b'New body', 'certificate': None, 'flags': [], 'headers': {'key': 'value'}, ...}
x = 'encoding'

    def replace(self, *args, **kwargs):
        """Create a new Response with the same attributes except for those given new values"""
        for x in self.attributes:
>           kwargs.setdefault(x, getattr(self, x))
E           AttributeError: 'CustomResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/http/response/__init__.py:123: AttributeError

test_http_response.py::CustomResponseTest::test_replace_wrong_encoding

test_http_response.py::CustomResponseTest::test_replace_wrong_encoding
self = 

    def test_replace_wrong_encoding(self):
        """Test invalid chars are replaced properly"""
        r = self.response_class(
            "http://www.example.com",
            encoding="utf-8",
            body=b"PREFIX\xe3\xabSUFFIX",
        )
        # XXX: Policy for replacing invalid chars may suffer minor variations
        # but it should always contain the unicode replacement char ('\ufffd')
>       assert "\ufffd" in r.text, repr(r.text)
E       TypeError: argument of type 'NoneType' is not iterable

/testbed/tests/test_http_response.py:568: TypeError

test_http_response.py::CustomResponseTest::test_selector

test_http_response.py::CustomResponseTest::test_selector
self = 

    def test_selector(self):
        body = b"Some page"
        response = self.response_class("http://www.example.com", body=body)

>       self.assertIsInstance(response.selector, Selector)
E       AttributeError: 'CustomResponse' object has no attribute 'selector'

/testbed/tests/test_http_response.py:588: AttributeError

test_http_response.py::CustomResponseTest::test_selector_shortcuts

test_http_response.py::CustomResponseTest::test_selector_shortcuts
self = 

    def test_selector_shortcuts(self):
        body = b"Some page"
        response = self.response_class("http://www.example.com", body=body)

        self.assertEqual(
>           response.xpath("//title/text()").getall(),
            response.selector.xpath("//title/text()").getall(),
        )

/testbed/tests/test_http_response.py:604: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://www.example.com>, a = ('//title/text()',), kw = {}

    def xpath(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:155: NotSupported

test_http_response.py::CustomResponseTest::test_selector_shortcuts_kwargs

test_http_response.py::CustomResponseTest::test_selector_shortcuts_kwargs
self = 

    def test_selector_shortcuts_kwargs(self):
        body = b'Some page

A nice paragraph.

' response = self.response_class("http://www.example.com", body=body) self.assertEqual( > response.xpath( "normalize-space(//p[@class=$pclass])", pclass="content" ).getall(), response.xpath('normalize-space(//p[@class="content"])').getall(), ) /testbed/tests/test_http_response.py:617: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <200 http://www.example.com> a = ('normalize-space(//p[@class=$pclass])',), kw = {'pclass': 'content'} def xpath(self, *a, **kw): """Shortcut method implemented only by responses whose content is text (subclasses of TextResponse). """ > raise NotSupported("Response content isn't text") E scrapy.exceptions.NotSupported: Response content isn't text /testbed/scrapy/http/response/__init__.py:155: NotSupported

test_http_response.py::CustomResponseTest::test_shortcut_attributes

test_http_response.py::CustomResponseTest::test_shortcut_attributes
self = 

    def test_shortcut_attributes(self):
        r = self.response_class("http://example.com", body=b"hello")
        if self.response_class == Response:
            msg = "Response content isn't text"
            self.assertRaisesRegex(AttributeError, msg, getattr, r, "text")
            self.assertRaisesRegex(NotSupported, msg, r.css, "body")
            self.assertRaisesRegex(NotSupported, msg, r.xpath, "//body")
            self.assertRaisesRegex(NotSupported, msg, r.jmespath, "body")
        else:
            r.text
>           r.css("body")

/testbed/tests/test_http_response.py:201: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <200 http://example.com>, a = ('body',), kw = {}

    def css(self, *a, **kw):
        """Shortcut method implemented only by responses whose content
        is text (subclasses of TextResponse).
        """
>       raise NotSupported("Response content isn't text")
E       scrapy.exceptions.NotSupported: Response content isn't text

/testbed/scrapy/http/response/__init__.py:143: NotSupported

test_http_response.py::CustomResponseTest::test_unicode_body

test_http_response.py::CustomResponseTest::test_unicode_body
self = 

    def test_unicode_body(self):
        unicode_string = (
            "\u043a\u0438\u0440\u0438\u043b\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0439 "
            "\u0442\u0435\u043a\u0441\u0442"
        )
        self.assertRaises(
            TypeError,
            self.response_class,
            "http://www.example.com",
            body="unicode body",
        )

        original_string = unicode_string.encode("cp1251")
        r1 = self.response_class(
            "http://www.example.com", body=original_string, encoding="cp1251"
        )

        # check response.text
>       self.assertTrue(isinstance(r1.text, str))
E       AssertionError: False is not true

/testbed/tests/test_http_response.py:417: AssertionError

test_http_response.py::CustomResponseTest::test_unicode_url

test_http_response.py::CustomResponseTest::test_unicode_url
self = 

    def test_unicode_url(self):
        # instantiate with unicode url without encoding (should set default encoding)
        resp = self.response_class("http://www.example.com/")
>       self._assert_response_encoding(resp, self.response_class._DEFAULT_ENCODING)

/testbed/tests/test_http_response.py:374: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
response = <200 http://www.example.com/>, encoding = 'ascii'

    def _assert_response_encoding(self, response, encoding):
>       self.assertEqual(response.encoding, resolve_encoding(encoding))
E       AttributeError: 'CustomResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/tests/test_http_response.py:178: AttributeError

test_http_response.py::CustomResponseTest::test_urljoin

test_http_response.py::CustomResponseTest::test_urljoin
self = 

    def test_urljoin(self):
        """Test urljoin shortcut (only for existence, since behavior equals urljoin)"""
        joined = self.response_class("http://www.example.com").urljoin("/test")
        absolute = "http://www.example.com/test"
>       self.assertEqual(joined, absolute)
E       AssertionError: None != 'http://www.example.com/test'

/testbed/tests/test_http_response.py:189: AssertionError

test_http_response.py::CustomResponseTest::test_urljoin_with_base_url

test_http_response.py::CustomResponseTest::test_urljoin_with_base_url
self = 

    def test_urljoin_with_base_url(self):
        """Test urljoin shortcut which also evaluates base-url through get_base_url()."""
        body = b''
        joined = self.response_class("http://www.example.com", body=body).urljoin(
            "/test"
        )
        absolute = "https://example.net/test"
>       self.assertEqual(joined, absolute)
E       AssertionError: None != 'https://example.net/test'

/testbed/tests/test_http_response.py:640: AssertionError

test_http_response.py::CustomResponseTest::test_utf16

test_http_response.py::CustomResponseTest::test_utf16
self = 

    def test_utf16(self):
        """Test utf-16 because UnicodeDammit is known to have problems with"""
        r = self.response_class(
            "http://www.example.com",
            body=b"\xff\xfeh\x00i\x00",
            encoding="utf-16",
        )
>       self._assert_response_values(r, "utf-16", "hi")

/testbed/tests/test_http_response.py:514: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
response = <200 http://www.example.com>, encoding = 'utf-16', body = 'hi'

    def _assert_response_values(self, response, encoding, body):
        if isinstance(body, str):
            body_unicode = body
            body_bytes = body.encode(encoding)
        else:
            body_unicode = body.decode(encoding)
            body_bytes = body

        assert isinstance(response.body, bytes)
>       assert isinstance(response.text, str)
E       AssertionError

/testbed/tests/test_http_response.py:172: AssertionError

test_item.py::ItemTest::test_copy

test_item.py::ItemTest::test_copy
self = 

    def test_copy(self):
        class TestItem(Item):
            name = Field()

        item = TestItem({"name": "lower"})
>       copied_item = item.copy()

/testbed/tests/test_item.py:250: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = {'name': 'lower'}, name = 'copy'

    def __getattr__(self, name):
        if name in self.fields:
            raise AttributeError(f'Use item[{name!r}] to get field value')
>       raise AttributeError(name)
E       AttributeError: copy

/testbed/scrapy/item.py:85: AttributeError

test_item.py::ItemTest::test_deepcopy

test_item.py::ItemTest::test_deepcopy
self = 

    def test_deepcopy(self):
        class TestItem(Item):
            tags = Field()

        item = TestItem({"tags": ["tag1"]})
        copied_item = item.deepcopy()
        item["tags"].append("tag2")
>       assert item["tags"] != copied_item["tags"]
E       TypeError: 'NoneType' object is not subscriptable

/testbed/tests/test_item.py:262: TypeError

test_linkextractors.py::LxmlLinkExtractorTestCase::test_area_tag_with_unicode_present

test_linkextractors.py::LxmlLinkExtractorTestCase::test_area_tag_with_unicode_present
self = 

    def test_area_tag_with_unicode_present(self):
        body = b"""\xbe\xa9"""
        response = HtmlResponse("http://example.org", body=body, encoding="utf-8")
        lx = self.extractor_cls()
>       lx.extract_links(response)

/testbed/tests/test_linkextractors.py:351: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/linkextractors/lxmlhtml.py:88: in extract_links
    base_url = get_base_url(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <200 http://example.org>

    def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
        """Return the base url of the given response, joined with the response url"""
        if response not in _baseurl_cache:
>           text = response.text[0:4096]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/utils/response.py:26: TypeError

test_linkextractors.py::LxmlLinkExtractorTestCase::test_attrs

test_linkextractors.py::LxmlLinkExtractorTestCase::test_attrs
self = 

    def test_attrs(self):
        lx = self.extractor_cls(attrs="href")
        page4_url = "http://example.com/page%204.html"

        self.assertEqual(
>           lx.extract_links(self.response),
            [
                Link(url="http://example.com/sample1.html", text=""),
                Link(url="http://example.com/sample2.html", text="sample 2"),
                Link(url="http://example.com/sample3.html", text="sample 3 text"),
                Link(
                    url="http://example.com/sample3.html#foo",
                    text="sample 3 repetition with fragment",
                ),
                Link(url="http://www.google.com/something", text=""),
                Link(url="http://example.com/innertag.html", text="inner tag"),
                Link(url=page4_url, text="href with whitespaces"),
            ],
        )

/testbed/tests/test_linkextractors.py:462: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/linkextractors/lxmlhtml.py:88: in extract_links
    base_url = get_base_url(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <200 http://example.com/index>

    def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
        """Return the base url of the given response, joined with the response url"""
        if response not in _baseurl_cache:
>           text = response.text[0:4096]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/utils/response.py:26: TypeError

test_linkextractors.py::LxmlLinkExtractorTestCase::test_base_url_with_restrict_xpaths

test_linkextractors.py::LxmlLinkExtractorTestCase::test_base_url_with_restrict_xpaths
self = 

    def test_base_url_with_restrict_xpaths(self):
        html = b"""Page title<title><base href="http://otherdomain.com/base/" />
        <body><p><a href="item/12.html">Item 12</a></p>
        </body></html>"""
        response = HtmlResponse("http://example.org/somepage/index.html", body=html)
        lx = self.extractor_cls(restrict_xpaths="//p")
        self.assertEqual(
>           lx.extract_links(response),
            [Link(url="http://otherdomain.com/base/item/12.html", text="Item 12")],
        )

/testbed/tests/test_linkextractors.py:453: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/linkextractors/lxmlhtml.py:88: in extract_links
    base_url = get_base_url(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <200 http://example.org/somepage/index.html>

    def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
        """Return the base url of the given response, joined with the response url"""
        if response not in _baseurl_cache:
>           text = response.text[0:4096]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/utils/response.py:26: TypeError
</pre>
</details>
<h3 id="test_linkextractorspylxmllinkextractortestcasetest_encoded_url">test_linkextractors.py::LxmlLinkExtractorTestCase::test_encoded_url</h3>
<details><summary> <pre>test_linkextractors.py::LxmlLinkExtractorTestCase::test_encoded_url</pre></summary><pre>
self = <tests.test_linkextractors.LxmlLinkExtractorTestCase testMethod=test_encoded_url>

    def test_encoded_url(self):
        body = b"""<html><body><div><a href="?page=2">BinB</a></body></html>"""
        response = HtmlResponse(
            "http://known.fm/AC%2FDC/", body=body, encoding="utf8"
        )
        lx = self.extractor_cls()
        self.assertEqual(
>           lx.extract_links(response),
            [
                Link(
                    url="http://known.fm/AC%2FDC/?page=2",
                    text="BinB",
                    fragment="",
                    nofollow=False,
                ),
            ],
        )

/testbed/tests/test_linkextractors.py:373: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/linkextractors/lxmlhtml.py:88: in extract_links
    base_url = get_base_url(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <200 http://known.fm/AC%2FDC/>

    def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
        """Return the base url of the given response, joined with the response url"""
        if response not in _baseurl_cache:
>           text = response.text[0:4096]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/utils/response.py:26: TypeError
</pre>
</details>
<h3 id="test_linkextractorspylxmllinkextractortestcasetest_encoded_url_in_restricted_xpath">test_linkextractors.py::LxmlLinkExtractorTestCase::test_encoded_url_in_restricted_xpath</h3>
<details><summary> <pre>test_linkextractors.py::LxmlLinkExtractorTestCase::test_encoded_url_in_restricted_xpath</pre></summary><pre>
self = <tests.test_linkextractors.LxmlLinkExtractorTestCase testMethod=test_encoded_url_in_restricted_xpath>

    def test_encoded_url_in_restricted_xpath(self):
        body = b"""<html><body><div><a href="?page=2">BinB</a></body></html>"""
        response = HtmlResponse(
            "http://known.fm/AC%2FDC/", body=body, encoding="utf8"
        )
        lx = self.extractor_cls(restrict_xpaths="//div")
        self.assertEqual(
>           lx.extract_links(response),
            [
                Link(
                    url="http://known.fm/AC%2FDC/?page=2",
                    text="BinB",
                    fragment="",
                    nofollow=False,
                ),
            ],
        )

/testbed/tests/test_linkextractors.py:391: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/linkextractors/lxmlhtml.py:88: in extract_links
    base_url = get_base_url(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <200 http://known.fm/AC%2FDC/>

    def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
        """Return the base url of the given response, joined with the response url"""
        if response not in _baseurl_cache:
>           text = response.text[0:4096]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/utils/response.py:26: TypeError
</pre>
</details>
<h3 id="test_linkextractorspylxmllinkextractortestcasetest_extract_all_links">test_linkextractors.py::LxmlLinkExtractorTestCase::test_extract_all_links</h3>
<details><summary> <pre>test_linkextractors.py::LxmlLinkExtractorTestCase::test_extract_all_links</pre></summary><pre>
self = <tests.test_linkextractors.LxmlLinkExtractorTestCase testMethod=test_extract_all_links>

    def test_extract_all_links(self):
        lx = self.extractor_cls()
        page4_url = "http://example.com/page%204.html"

        self.assertEqual(
>           [link for link in lx.extract_links(self.response)],
            [
                Link(url="http://example.com/sample1.html", text=""),
                Link(url="http://example.com/sample2.html", text="sample 2"),
                Link(url="http://example.com/sample3.html", text="sample 3 text"),
                Link(
                    url="http://example.com/sample3.html#foo",
                    text="sample 3 repetition with fragment",
                ),
                Link(url="http://www.google.com/something", text=""),
                Link(url="http://example.com/innertag.html", text="inner tag"),
                Link(url=page4_url, text="href with whitespaces"),
            ],
        )

/testbed/tests/test_linkextractors.py:39: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/linkextractors/lxmlhtml.py:88: in extract_links
    base_url = get_base_url(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <200 http://example.com/index>

    def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
        """Return the base url of the given response, joined with the response url"""
        if response not in _baseurl_cache:
>           text = response.text[0:4096]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/utils/response.py:26: TypeError
</pre>
</details>
<h3 id="test_linkextractorspylxmllinkextractortestcasetest_extract_filter_allow">test_linkextractors.py::LxmlLinkExtractorTestCase::test_extract_filter_allow</h3>
<details><summary> <pre>test_linkextractors.py::LxmlLinkExtractorTestCase::test_extract_filter_allow</pre></summary><pre>
self = <tests.test_linkextractors.LxmlLinkExtractorTestCase testMethod=test_extract_filter_allow>

    def test_extract_filter_allow(self):
        lx = self.extractor_cls(allow=("sample",))
        self.assertEqual(
>           [link for link in lx.extract_links(self.response)],
            [
                Link(url="http://example.com/sample1.html", text=""),
                Link(url="http://example.com/sample2.html", text="sample 2"),
                Link(url="http://example.com/sample3.html", text="sample 3 text"),
                Link(
                    url="http://example.com/sample3.html#foo",
                    text="sample 3 repetition with fragment",
                ),
            ],
        )

/testbed/tests/test_linkextractors.py:57: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/linkextractors/lxmlhtml.py:88: in extract_links
    base_url = get_base_url(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <200 http://example.com/index>

    def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
        """Return the base url of the given response, joined with the response url"""
        if response not in _baseurl_cache:
>           text = response.text[0:4096]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/utils/response.py:26: TypeError
</pre>
</details>
<h3 id="test_linkextractorspylxmllinkextractortestcasetest_extract_filter_allow_and_deny">test_linkextractors.py::LxmlLinkExtractorTestCase::test_extract_filter_allow_and_deny</h3>
<details><summary> <pre>test_linkextractors.py::LxmlLinkExtractorTestCase::test_extract_filter_allow_and_deny</pre></summary><pre>
self = <tests.test_linkextractors.LxmlLinkExtractorTestCase testMethod=test_extract_filter_allow_and_deny>

    def test_extract_filter_allow_and_deny(self):
        lx = self.extractor_cls(allow=("sample",), deny=("3",))
        self.assertEqual(
>           [link for link in lx.extract_links(self.response)],
            [
                Link(url="http://example.com/sample1.html", text=""),
                Link(url="http://example.com/sample2.html", text="sample 2"),
            ],
        )

/testbed/tests/test_linkextractors.py:129: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/linkextractors/lxmlhtml.py:88: in extract_links
    base_url = get_base_url(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <200 http://example.com/index>

    def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
        """Return the base url of the given response, joined with the response url"""
        if response not in _baseurl_cache:
>           text = response.text[0:4096]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/utils/response.py:26: TypeError
</pre>
</details>
<h3 id="test_linkextractorspylxmllinkextractortestcasetest_extract_filter_allow_no_duplicates_canonicalize">test_linkextractors.py::LxmlLinkExtractorTestCase::test_extract_filter_allow_no_duplicates_canonicalize</h3>
<details><summary> <pre>test_linkextractors.py::LxmlLinkExtractorTestCase::test_extract_filter_allow_no_duplicates_canonicalize</pre></summary><pre>
self = <tests.test_linkextractors.LxmlLinkExtractorTestCase testMethod=test_extract_filter_allow_no_duplicates_canonicalize>

    def test_extract_filter_allow_no_duplicates_canonicalize(self):
        lx = self.extractor_cls(allow=("sample",), unique=True, canonicalize=True)
        self.assertEqual(
>           [link for link in lx.extract_links(self.response)],
            [
                Link(url="http://example.com/sample1.html", text=""),
                Link(url="http://example.com/sample2.html", text="sample 2"),
                Link(url="http://example.com/sample3.html", text="sample 3 text"),
            ],
        )

/testbed/tests/test_linkextractors.py:118: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/linkextractors/lxmlhtml.py:88: in extract_links
    base_url = get_base_url(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <200 http://example.com/index>

    def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
        """Return the base url of the given response, joined with the response url"""
        if response not in _baseurl_cache:
>           text = response.text[0:4096]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/utils/response.py:26: TypeError
</pre>
</details>
<h3 id="test_linkextractorspylxmllinkextractortestcasetest_extract_filter_allow_with_duplicates">test_linkextractors.py::LxmlLinkExtractorTestCase::test_extract_filter_allow_with_duplicates</h3>
<details><summary> <pre>test_linkextractors.py::LxmlLinkExtractorTestCase::test_extract_filter_allow_with_duplicates</pre></summary><pre>
self = <tests.test_linkextractors.LxmlLinkExtractorTestCase testMethod=test_extract_filter_allow_with_duplicates>

    def test_extract_filter_allow_with_duplicates(self):
        lx = self.extractor_cls(allow=("sample",), unique=False)
        self.assertEqual(
>           [link for link in lx.extract_links(self.response)],
            [
                Link(url="http://example.com/sample1.html", text=""),
                Link(url="http://example.com/sample2.html", text="sample 2"),
                Link(url="http://example.com/sample3.html", text="sample 3 text"),
                Link(
                    url="http://example.com/sample3.html",
                    text="sample 3 repetition",
                ),
                Link(
                    url="http://example.com/sample3.html",
                    text="sample 3 repetition",
                ),
                Link(
                    url="http://example.com/sample3.html#foo",
                    text="sample 3 repetition with fragment",
                ),
            ],
        )

/testbed/tests/test_linkextractors.py:72: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/linkextractors/lxmlhtml.py:88: in extract_links
    base_url = get_base_url(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <200 http://example.com/index>

    def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
        """Return the base url of the given response, joined with the response url"""
        if response not in _baseurl_cache:
>           text = response.text[0:4096]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/utils/response.py:26: TypeError
</pre>
</details>
<h3 id="test_linkextractorspylxmllinkextractortestcasetest_extract_filter_allow_with_duplicates_canonicalize">test_linkextractors.py::LxmlLinkExtractorTestCase::test_extract_filter_allow_with_duplicates_canonicalize</h3>
<details><summary> <pre>test_linkextractors.py::LxmlLinkExtractorTestCase::test_extract_filter_allow_with_duplicates_canonicalize</pre></summary><pre>
self = <tests.test_linkextractors.LxmlLinkExtractorTestCase testMethod=test_extract_filter_allow_with_duplicates_canonicalize>

    def test_extract_filter_allow_with_duplicates_canonicalize(self):
        lx = self.extractor_cls(allow=("sample",), unique=False, canonicalize=True)
        self.assertEqual(
>           [link for link in lx.extract_links(self.response)],
            [
                Link(url="http://example.com/sample1.html", text=""),
                Link(url="http://example.com/sample2.html", text="sample 2"),
                Link(url="http://example.com/sample3.html", text="sample 3 text"),
                Link(
                    url="http://example.com/sample3.html",
                    text="sample 3 repetition",
                ),
                Link(
                    url="http://example.com/sample3.html",
                    text="sample 3 repetition",
                ),
                Link(
                    url="http://example.com/sample3.html",
                    text="sample 3 repetition with fragment",
                ),
            ],
        )

/testbed/tests/test_linkextractors.py:95: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/linkextractors/lxmlhtml.py:88: in extract_links
    base_url = get_base_url(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <200 http://example.com/index>

    def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
        """Return the base url of the given response, joined with the response url"""
        if response not in _baseurl_cache:
>           text = response.text[0:4096]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/utils/response.py:26: TypeError
</pre>
</details>
<h3 id="test_linkextractorspylxmllinkextractortestcasetest_extract_filter_allowed_domains">test_linkextractors.py::LxmlLinkExtractorTestCase::test_extract_filter_allowed_domains</h3>
<details><summary> <pre>test_linkextractors.py::LxmlLinkExtractorTestCase::test_extract_filter_allowed_domains</pre></summary><pre>
self = <tests.test_linkextractors.LxmlLinkExtractorTestCase testMethod=test_extract_filter_allowed_domains>

    def test_extract_filter_allowed_domains(self):
        lx = self.extractor_cls(allow_domains=("google.com",))
        self.assertEqual(
>           [link for link in lx.extract_links(self.response)],
            [
                Link(url="http://www.google.com/something", text=""),
            ],
        )

/testbed/tests/test_linkextractors.py:139: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/linkextractors/lxmlhtml.py:88: in extract_links
    base_url = get_base_url(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <200 http://example.com/index>

    def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
        """Return the base url of the given response, joined with the response url"""
        if response not in _baseurl_cache:
>           text = response.text[0:4096]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/utils/response.py:26: TypeError
</pre>
</details>
<h3 id="test_linkextractorspylxmllinkextractortestcasetest_extraction_using_single_values">test_linkextractors.py::LxmlLinkExtractorTestCase::test_extraction_using_single_values</h3>
<details><summary> <pre>test_linkextractors.py::LxmlLinkExtractorTestCase::test_extraction_using_single_values</pre></summary><pre>
self = <tests.test_linkextractors.LxmlLinkExtractorTestCase testMethod=test_extraction_using_single_values>

    def test_extraction_using_single_values(self):
        """Test the extractor's behaviour among different situations"""

        lx = self.extractor_cls(allow="sample")
        self.assertEqual(
>           [link for link in lx.extract_links(self.response)],
            [
                Link(url="http://example.com/sample1.html", text=""),
                Link(url="http://example.com/sample2.html", text="sample 2"),
                Link(url="http://example.com/sample3.html", text="sample 3 text"),
                Link(
                    url="http://example.com/sample3.html#foo",
                    text="sample 3 repetition with fragment",
                ),
            ],
        )

/testbed/tests/test_linkextractors.py:150: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/linkextractors/lxmlhtml.py:88: in extract_links
    base_url = get_base_url(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <200 http://example.com/index>

    def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
        """Return the base url of the given response, joined with the response url"""
        if response not in _baseurl_cache:
>           text = response.text[0:4096]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/utils/response.py:26: TypeError
</pre>
</details>
<h3 id="test_linkextractorspylxmllinkextractortestcasetest_ftp_links">test_linkextractors.py::LxmlLinkExtractorTestCase::test_ftp_links</h3>
<details><summary> <pre>test_linkextractors.py::LxmlLinkExtractorTestCase::test_ftp_links</pre></summary><pre>
self = <tests.test_linkextractors.LxmlLinkExtractorTestCase testMethod=test_ftp_links>

    def test_ftp_links(self):
        body = b"""
        <html><body>
        <div><a href="ftp://www.external.com/">An Item</a></div>
        </body></html>"""
        response = HtmlResponse(
            "http://www.example.com/index.html", body=body, encoding="utf8"
        )
        lx = self.extractor_cls()
        self.assertEqual(
>           lx.extract_links(response),
            [
                Link(
                    url="ftp://www.external.com/",
                    text="An Item",
                    fragment="",
                    nofollow=False,
                ),
            ],
        )

/testbed/tests/test_linkextractors.py:732: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/linkextractors/lxmlhtml.py:88: in extract_links
    base_url = get_base_url(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <200 http://www.example.com/index.html>

    def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
        """Return the base url of the given response, joined with the response url"""
        if response not in _baseurl_cache:
>           text = response.text[0:4096]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/utils/response.py:26: TypeError
</pre>
</details>
<h3 id="test_linkextractorspylxmllinkextractortestcasetest_ignored_extensions">test_linkextractors.py::LxmlLinkExtractorTestCase::test_ignored_extensions</h3>
<details><summary> <pre>test_linkextractors.py::LxmlLinkExtractorTestCase::test_ignored_extensions</pre></summary><pre>
self = <tests.test_linkextractors.LxmlLinkExtractorTestCase testMethod=test_ignored_extensions>

    def test_ignored_extensions(self):
        # jpg is ignored by default
        html = b"""<a href="page.html">asd</a> and <a href="photo.jpg">"""
        response = HtmlResponse("http://example.org/", body=html)
        lx = self.extractor_cls()
        self.assertEqual(
>           lx.extract_links(response),
            [
                Link(url="http://example.org/page.html", text="asd"),
            ],
        )

/testbed/tests/test_linkextractors.py:408: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/linkextractors/lxmlhtml.py:88: in extract_links
    base_url = get_base_url(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <200 http://example.org/>

    def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
        """Return the base url of the given response, joined with the response url"""
        if response not in _baseurl_cache:
>           text = response.text[0:4096]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/utils/response.py:26: TypeError
</pre>
</details>
<h3 id="test_linkextractorspylxmllinkextractortestcasetest_link_extractor_aggregation">test_linkextractors.py::LxmlLinkExtractorTestCase::test_link_extractor_aggregation</h3>
<details><summary> <pre>test_linkextractors.py::LxmlLinkExtractorTestCase::test_link_extractor_aggregation</pre></summary><pre>
self = <tests.test_linkextractors.LxmlLinkExtractorTestCase testMethod=test_link_extractor_aggregation>

    def test_link_extractor_aggregation(self):
        """When a parameter like restrict_css is used, the underlying
        implementation calls its internal link extractor once per selector
        matching the specified restrictions, and then aggregates the
        extracted links.

        Test that aggregation respects the unique and canonicalize
        parameters.
        """
        # unique=True (default), canonicalize=False (default)
        lx = self.extractor_cls(restrict_css=("div",))
        response = HtmlResponse(
            "https://example.com",
            body=b"""
                <div>
                    <a href="/a">a1</a>
                    <a href="/b?a=1&b=2">b1</a>
                </div>
                <div>
                    <a href="/a">a2</a>
                    <a href="/b?b=2&a=1">b2</a>
                </div>
            """,
        )
>       actual = lx.extract_links(response)

/testbed/tests/test_linkextractors.py:771: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/linkextractors/lxmlhtml.py:88: in extract_links
    base_url = get_base_url(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <200 https://example.com>

    def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
        """Return the base url of the given response, joined with the response url"""
        if response not in _baseurl_cache:
>           text = response.text[0:4096]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/utils/response.py:26: TypeError
</pre>
</details>
<h3 id="test_linkextractorspylxmllinkextractortestcasetest_link_restrict_text">test_linkextractors.py::LxmlLinkExtractorTestCase::test_link_restrict_text</h3>
<details><summary> <pre>test_linkextractors.py::LxmlLinkExtractorTestCase::test_link_restrict_text</pre></summary><pre>
self = <tests.test_linkextractors.LxmlLinkExtractorTestCase testMethod=test_link_restrict_text>

    def test_link_restrict_text(self):
        html = b"""
        <a href="http://example.org/item1.html">Pic of a cat</a>
        <a href="http://example.org/item2.html">Pic of a dog</a>
        <a href="http://example.org/item3.html">Pic of a cow</a>
        """
        response = HtmlResponse("http://example.org/index.html", body=html)
        # Simple text inclusion test
        lx = self.extractor_cls(restrict_text="dog")
        self.assertEqual(
>           [link for link in lx.extract_links(response)],
            [
                Link(
                    url="http://example.org/item2.html",
                    text="Pic of a dog",
                    nofollow=False,
                ),
            ],
        )

/testbed/tests/test_linkextractors.py:893: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/linkextractors/lxmlhtml.py:88: in extract_links
    base_url = get_base_url(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <200 http://example.org/index.html>

    def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
        """Return the base url of the given response, joined with the response url"""
        if response not in _baseurl_cache:
>           text = response.text[0:4096]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/utils/response.py:26: TypeError
</pre>
</details>
<h3 id="test_linkextractorspylxmllinkextractortestcasetest_link_wrong_href">test_linkextractors.py::LxmlLinkExtractorTestCase::test_link_wrong_href</h3>
<details><summary> <pre>test_linkextractors.py::LxmlLinkExtractorTestCase::test_link_wrong_href</pre></summary><pre>
self = <tests.test_linkextractors.LxmlLinkExtractorTestCase testMethod=test_link_wrong_href>

    def test_link_wrong_href(self):
        html = b"""
        <a href="http://example.org/item1.html">Item 1</a>
        <a href="http://[example.org/item2.html">Item 2</a>
        <a href="http://example.org/item3.html">Item 3</a>
        """
        response = HtmlResponse("http://example.org/index.html", body=html)
        lx = self.extractor_cls()
        self.assertEqual(
>           [link for link in lx.extract_links(response)],
            [
                Link(
                    url="http://example.org/item1.html", text="Item 1", nofollow=False
                ),
                Link(
                    url="http://example.org/item3.html", text="Item 3", nofollow=False
                ),
            ],
        )

/testbed/tests/test_linkextractors.py:872: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/linkextractors/lxmlhtml.py:88: in extract_links
    base_url = get_base_url(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <200 http://example.org/index.html>

    def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
        """Return the base url of the given response, joined with the response url"""
        if response not in _baseurl_cache:
>           text = response.text[0:4096]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/utils/response.py:26: TypeError
</pre>
</details>
<h3 id="test_linkextractorspylxmllinkextractortestcasetest_matches">test_linkextractors.py::LxmlLinkExtractorTestCase::test_matches</h3>
<details><summary> <pre>test_linkextractors.py::LxmlLinkExtractorTestCase::test_matches</pre></summary><pre>
self = <tests.test_linkextractors.LxmlLinkExtractorTestCase testMethod=test_matches>

    def test_matches(self):
        url1 = "http://lotsofstuff.com/stuff1/index"
        url2 = "http://evenmorestuff.com/uglystuff/index"

        lx = self.extractor_cls(allow=(r"stuff1",))
>       self.assertEqual(lx.matches(url1), True)
E       AttributeError: 'LxmlLinkExtractor' object has no attribute 'matches'

/testbed/tests/test_linkextractors.py:238: AttributeError
</pre>
</details>
<h3 id="test_linkextractorspylxmllinkextractortestcasetest_nofollow">test_linkextractors.py::LxmlLinkExtractorTestCase::test_nofollow</h3>
<details><summary> <pre>test_linkextractors.py::LxmlLinkExtractorTestCase::test_nofollow</pre></summary><pre>
self = <tests.test_linkextractors.LxmlLinkExtractorTestCase testMethod=test_nofollow>

    def test_nofollow(self):
        '''Test the extractor's behaviour for links with rel="nofollow"'''

        html = b"""<html><head><title>Page title<title>
        <body>
        <div class='links'>
        <p><a href="/about.html">About us</a></p>
        </div>
        <div>
        <p><a href="/follow.html">Follow this link</a></p>
        </div>
        <div>
        <p><a href="/nofollow.html" rel="nofollow">Dont follow this one</a></p>
        </div>
        <div>
        <p><a href="/nofollow2.html" rel="blah">Choose to follow or not</a></p>
        </div>
        <div>
        <p><a href="http://google.com/something" rel="external nofollow">External link not to follow</a></p>
        </div>
        </body></html>"""
        response = HtmlResponse("http://example.org/somepage/index.html", body=html)

        lx = self.extractor_cls()
        self.assertEqual(
>           lx.extract_links(response),
            [
                Link(url="http://example.org/about.html", text="About us"),
                Link(url="http://example.org/follow.html", text="Follow this link"),
                Link(
                    url="http://example.org/nofollow.html",
                    text="Dont follow this one",
                    nofollow=True,
                ),
                Link(
                    url="http://example.org/nofollow2.html",
                    text="Choose to follow or not",
                ),
                Link(
                    url="http://google.com/something",
                    text="External link not to follow",
                    nofollow=True,
                ),
            ],
        )

/testbed/tests/test_linkextractors.py:212: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/linkextractors/lxmlhtml.py:88: in extract_links
    base_url = get_base_url(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <200 http://example.org/somepage/index.html>

    def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
        """Return the base url of the given response, joined with the response url"""
        if response not in _baseurl_cache:
>           text = response.text[0:4096]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/utils/response.py:26: TypeError
</pre>
</details>
<h3 id="test_linkextractorspylxmllinkextractortestcasetest_process_value">test_linkextractors.py::LxmlLinkExtractorTestCase::test_process_value</h3>
<details><summary> <pre>test_linkextractors.py::LxmlLinkExtractorTestCase::test_process_value</pre></summary><pre>
self = <tests.test_linkextractors.LxmlLinkExtractorTestCase testMethod=test_process_value>

            def test_process_value(self):
                """Test restrict_xpaths with encodings"""
                html = b"""
    <a href="javascript:goToPage('../other/page.html','photo','width=600,height=540,scrollbars'); return false">Text</a>
    <a href="/about.html">About us</a>
                """
                response = HtmlResponse(
                    "http://example.org/somepage/index.html",
                    body=html,
                    encoding="windows-1252",
                )

                def process_value(value):
                    m = re.search(r"javascript:goToPage\('(.*?)'", value)
                    if m:
                        return m.group(1)

                lx = self.extractor_cls(process_value=process_value)
                self.assertEqual(
>                   lx.extract_links(response),
                    [Link(url="http://example.org/other/page.html", text="Text")],
                )

/testbed/tests/test_linkextractors.py:442: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/linkextractors/lxmlhtml.py:88: in extract_links
    base_url = get_base_url(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <200 http://example.org/somepage/index.html>

    def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
        """Return the base url of the given response, joined with the response url"""
        if response not in _baseurl_cache:
>           text = response.text[0:4096]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/utils/response.py:26: TypeError
</pre>
</details>
<h3 id="test_linkextractorspylxmllinkextractortestcasetest_restrict_css">test_linkextractors.py::LxmlLinkExtractorTestCase::test_restrict_css</h3>
<details><summary> <pre>test_linkextractors.py::LxmlLinkExtractorTestCase::test_restrict_css</pre></summary><pre>
self = <tests.test_linkextractors.LxmlLinkExtractorTestCase testMethod=test_restrict_css>

    def test_restrict_css(self):
        lx = self.extractor_cls(restrict_css=("#subwrapper a",))
        self.assertEqual(
>           lx.extract_links(self.response),
            [Link(url="http://example.com/sample2.html", text="sample 2")],
        )

/testbed/tests/test_linkextractors.py:329: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/linkextractors/lxmlhtml.py:88: in extract_links
    base_url = get_base_url(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <200 http://example.com/index>

    def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
        """Return the base url of the given response, joined with the response url"""
        if response not in _baseurl_cache:
>           text = response.text[0:4096]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/utils/response.py:26: TypeError
</pre>
</details>
<h3 id="test_linkextractorspylxmllinkextractortestcasetest_restrict_css_and_restrict_xpaths_together">test_linkextractors.py::LxmlLinkExtractorTestCase::test_restrict_css_and_restrict_xpaths_together</h3>
<details><summary> <pre>test_linkextractors.py::LxmlLinkExtractorTestCase::test_restrict_css_and_restrict_xpaths_together</pre></summary><pre>
self = <tests.test_linkextractors.LxmlLinkExtractorTestCase testMethod=test_restrict_css_and_restrict_xpaths_together>

    def test_restrict_css_and_restrict_xpaths_together(self):
        lx = self.extractor_cls(
            restrict_xpaths=('//div[@id="subwrapper"]',),
            restrict_css=("#subwrapper + a",),
        )
        self.assertEqual(
>           [link for link in lx.extract_links(self.response)],
            [
                Link(url="http://example.com/sample1.html", text=""),
                Link(url="http://example.com/sample2.html", text="sample 2"),
                Link(url="http://example.com/sample3.html", text="sample 3 text"),
            ],
        )

/testbed/tests/test_linkextractors.py:339: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/linkextractors/lxmlhtml.py:88: in extract_links
    base_url = get_base_url(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <200 http://example.com/index>

    def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
        """Return the base url of the given response, joined with the response url"""
        if response not in _baseurl_cache:
>           text = response.text[0:4096]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/utils/response.py:26: TypeError
</pre>
</details>
<h3 id="test_linkextractorspylxmllinkextractortestcasetest_restrict_xpaths">test_linkextractors.py::LxmlLinkExtractorTestCase::test_restrict_xpaths</h3>
<details><summary> <pre>test_linkextractors.py::LxmlLinkExtractorTestCase::test_restrict_xpaths</pre></summary><pre>
self = <tests.test_linkextractors.LxmlLinkExtractorTestCase testMethod=test_restrict_xpaths>

    def test_restrict_xpaths(self):
        lx = self.extractor_cls(restrict_xpaths=('//div[@id="subwrapper"]',))
        self.assertEqual(
>           [link for link in lx.extract_links(self.response)],
            [
                Link(url="http://example.com/sample1.html", text=""),
                Link(url="http://example.com/sample2.html", text="sample 2"),
            ],
        )

/testbed/tests/test_linkextractors.py:267: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/linkextractors/lxmlhtml.py:88: in extract_links
    base_url = get_base_url(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <200 http://example.com/index>

    def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
        """Return the base url of the given response, joined with the response url"""
        if response not in _baseurl_cache:
>           text = response.text[0:4096]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/utils/response.py:26: TypeError
</pre>
</details>
<h3 id="test_linkextractorspylxmllinkextractortestcasetest_restrict_xpaths_concat_in_handle_data">test_linkextractors.py::LxmlLinkExtractorTestCase::test_restrict_xpaths_concat_in_handle_data</h3>
<details><summary> <pre>test_linkextractors.py::LxmlLinkExtractorTestCase::test_restrict_xpaths_concat_in_handle_data</pre></summary><pre>
self = <tests.test_linkextractors.LxmlLinkExtractorTestCase testMethod=test_restrict_xpaths_concat_in_handle_data>

    def test_restrict_xpaths_concat_in_handle_data(self):
        """html entities cause SGMLParser to call handle_data hook twice"""
        body = b"""<html><body><div><a href="/foo">>\xbe\xa9<\xb6\xab</a></body></html>"""
        response = HtmlResponse("http://example.org", body=body, encoding="gb18030")
        lx = self.extractor_cls(restrict_xpaths="//div")
        self.assertEqual(
>           lx.extract_links(response),
            [
                Link(
                    url="http://example.org/foo",
                    text=">\u4eac<\u4e1c",
                    fragment="",
                    nofollow=False,
                )
            ],
        )

/testbed/tests/test_linkextractors.py:315: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/linkextractors/lxmlhtml.py:88: in extract_links
    base_url = get_base_url(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <200 http://example.org>

    def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
        """Return the base url of the given response, joined with the response url"""
        if response not in _baseurl_cache:
>           text = response.text[0:4096]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/utils/response.py:26: TypeError
</pre>
</details>
<h3 id="test_linkextractorspylxmllinkextractortestcasetest_restrict_xpaths_encoding">test_linkextractors.py::LxmlLinkExtractorTestCase::test_restrict_xpaths_encoding</h3>
<details><summary> <pre>test_linkextractors.py::LxmlLinkExtractorTestCase::test_restrict_xpaths_encoding</pre></summary><pre>
self = <tests.test_linkextractors.LxmlLinkExtractorTestCase testMethod=test_restrict_xpaths_encoding>

    def test_restrict_xpaths_encoding(self):
        """Test restrict_xpaths with encodings"""
        html = b"""<html><head><title>Page title<title>
        <body><p><a href="item/12.html">Item 12</a></p>
        <div class='links'>
        <p><a href="/about.html">About us\xa3</a></p>
        </div>
        <div>
        <p><a href="/nofollow.html">This shouldn't be followed</a></p>
        </div>
        </body></html>"""
        response = HtmlResponse(
            "http://example.org/somepage/index.html",
            body=html,
            encoding="windows-1252",
        )

        lx = self.extractor_cls(restrict_xpaths="//div[@class='links']")
        self.assertEqual(
>           lx.extract_links(response),
            [Link(url="http://example.org/about.html", text="About us\xa3")],
        )

/testbed/tests/test_linkextractors.py:293: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/linkextractors/lxmlhtml.py:88: in extract_links
    base_url = get_base_url(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <200 http://example.org/somepage/index.html>

    def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
        """Return the base url of the given response, joined with the response url"""
        if response not in _baseurl_cache:
>           text = response.text[0:4096]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/utils/response.py:26: TypeError
</pre>
</details>
<h3 id="test_linkextractorspylxmllinkextractortestcasetest_restrict_xpaths_with_html_entities">test_linkextractors.py::LxmlLinkExtractorTestCase::test_restrict_xpaths_with_html_entities</h3>
<details><summary> <pre>test_linkextractors.py::LxmlLinkExtractorTestCase::test_restrict_xpaths_with_html_entities</pre></summary><pre>
self = <tests.test_linkextractors.LxmlLinkExtractorTestCase testMethod=test_restrict_xpaths_with_html_entities>

    def test_restrict_xpaths_with_html_entities(self):
>       super().test_restrict_xpaths_with_html_entities()

/testbed/tests/test_linkextractors.py:933: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_linkextractors.py:304: in test_restrict_xpaths_with_html_entities
    links = self.extractor_cls(restrict_xpaths="//p").extract_links(response)
/testbed/scrapy/linkextractors/lxmlhtml.py:88: in extract_links
    base_url = get_base_url(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <200 http://example.org/somepage/index.html>

    def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
        """Return the base url of the given response, joined with the response url"""
        if response not in _baseurl_cache:
>           text = response.text[0:4096]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/utils/response.py:26: TypeError
</pre>
</details>
<h3 id="test_linkextractorspylxmllinkextractortestcasetest_skip_bad_links">test_linkextractors.py::LxmlLinkExtractorTestCase::test_skip_bad_links</h3>
<details><summary> <pre>test_linkextractors.py::LxmlLinkExtractorTestCase::test_skip_bad_links</pre></summary><pre>
self = <tests.test_linkextractors.LxmlLinkExtractorTestCase testMethod=test_skip_bad_links>

    @mark.skipif(
        Version(w3lib_version) < Version("2.0.0"),
        reason=(
            "Before w3lib 2.0.0, w3lib.url.safe_url_string would not complain "
            "about an invalid port value."
        ),
    )
    def test_skip_bad_links(self):
        html = b"""
        <a href="http://example.org:non-port">Why would you do this?</a>
        <a href="http://example.org/item2.html">Good Link</a>
        <a href="http://example.org/item3.html">Good Link 2</a>
        """
        response = HtmlResponse("http://example.org/index.html", body=html)
        lx = self.extractor_cls()
        self.assertEqual(
>           [link for link in lx.extract_links(response)],
            [
                Link(
                    url="http://example.org/item2.html",
                    text="Good Link",
                    nofollow=False,
                ),
                Link(
                    url="http://example.org/item3.html",
                    text="Good Link 2",
                    nofollow=False,
                ),
            ],
        )

/testbed/tests/test_linkextractors.py:951: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/linkextractors/lxmlhtml.py:88: in extract_links
    base_url = get_base_url(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <200 http://example.org/index.html>

    def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
        """Return the base url of the given response, joined with the response url"""
        if response not in _baseurl_cache:
>           text = response.text[0:4096]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/utils/response.py:26: TypeError
</pre>
</details>
<h3 id="test_linkextractorspylxmllinkextractortestcasetest_tags">test_linkextractors.py::LxmlLinkExtractorTestCase::test_tags</h3>
<details><summary> <pre>test_linkextractors.py::LxmlLinkExtractorTestCase::test_tags</pre></summary><pre>
self = <tests.test_linkextractors.LxmlLinkExtractorTestCase testMethod=test_tags>

    def test_tags(self):
        html = (
            b'<html><area href="sample1.html"></area>'
            b'<a href="sample2.html">sample 2</a><img src="sample2.jpg"/></html>'
        )
        response = HtmlResponse("http://example.com/index.html", body=html)

        lx = self.extractor_cls(tags=None)
>       self.assertEqual(lx.extract_links(response), [])

/testbed/tests/test_linkextractors.py:508: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/linkextractors/lxmlhtml.py:88: in extract_links
    base_url = get_base_url(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <200 http://example.com/index.html>

    def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
        """Return the base url of the given response, joined with the response url"""
        if response not in _baseurl_cache:
>           text = response.text[0:4096]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/utils/response.py:26: TypeError
</pre>
</details>
<h3 id="test_linkextractorspylxmllinkextractortestcasetest_tags_attrs">test_linkextractors.py::LxmlLinkExtractorTestCase::test_tags_attrs</h3>
<details><summary> <pre>test_linkextractors.py::LxmlLinkExtractorTestCase::test_tags_attrs</pre></summary><pre>
self = <tests.test_linkextractors.LxmlLinkExtractorTestCase testMethod=test_tags_attrs>

    def test_tags_attrs(self):
        html = b"""
        <html><body>
        <div id="item1" data-url="get?id=1"><a href="#">Item 1</a></div>
        <div id="item2" data-url="get?id=2"><a href="#">Item 2</a></div>
        </body></html>
        """
        response = HtmlResponse("http://example.com/index.html", body=html)

        lx = self.extractor_cls(tags="div", attrs="data-url")
        self.assertEqual(
>           lx.extract_links(response),
            [
                Link(
                    url="http://example.com/get?id=1",
                    text="Item 1",
                    fragment="",
                    nofollow=False,
                ),
                Link(
                    url="http://example.com/get?id=2",
                    text="Item 2",
                    fragment="",
                    nofollow=False,
                ),
            ],
        )

/testbed/tests/test_linkextractors.py:557: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/linkextractors/lxmlhtml.py:88: in extract_links
    base_url = get_base_url(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <200 http://example.com/index.html>

    def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
        """Return the base url of the given response, joined with the response url"""
        if response not in _baseurl_cache:
>           text = response.text[0:4096]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/utils/response.py:26: TypeError
</pre>
</details>
<h3 id="test_linkextractorspylxmllinkextractortestcasetest_urls_type">test_linkextractors.py::LxmlLinkExtractorTestCase::test_urls_type</h3>
<details><summary> <pre>test_linkextractors.py::LxmlLinkExtractorTestCase::test_urls_type</pre></summary><pre>
self = <tests.test_linkextractors.LxmlLinkExtractorTestCase testMethod=test_urls_type>

    def test_urls_type(self):
        """Test that the resulting urls are str objects"""
        lx = self.extractor_cls()
        self.assertTrue(
            all(
                isinstance(link.url, str)
>               for link in lx.extract_links(self.response)
            )
        )

/testbed/tests/test_linkextractors.py:30: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/linkextractors/lxmlhtml.py:88: in extract_links
    base_url = get_base_url(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <200 http://example.com/index>

    def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
        """Return the base url of the given response, joined with the response url"""
        if response not in _baseurl_cache:
>           text = response.text[0:4096]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/utils/response.py:26: TypeError
</pre>
</details>
<h3 id="test_linkextractorspylxmllinkextractortestcasetest_xhtml">test_linkextractors.py::LxmlLinkExtractorTestCase::test_xhtml</h3>
<details><summary> <pre>test_linkextractors.py::LxmlLinkExtractorTestCase::test_xhtml</pre></summary><pre>
self = <tests.test_linkextractors.LxmlLinkExtractorTestCase testMethod=test_xhtml>

        def test_xhtml(self):
            xhtml = b"""
    <?xml version="1.0"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <title>XHTML document title
    
    
        
        
        
        
        
    
    
            """

            response = HtmlResponse("http://example.com/index.xhtml", body=xhtml)

            lx = self.extractor_cls()
            self.assertEqual(
>               lx.extract_links(response),
                [
                    Link(
                        url="http://example.com/about.html",
                        text="About us",
                        fragment="",
                        nofollow=False,
                    ),
                    Link(
                        url="http://example.com/follow.html",
                        text="Follow this link",
                        fragment="",
                        nofollow=False,
                    ),
                    Link(
                        url="http://example.com/nofollow.html",
                        text="Dont follow this one",
                        fragment="",
                        nofollow=True,
                    ),
                    Link(
                        url="http://example.com/nofollow2.html",
                        text="Choose to follow or not",
                        fragment="",
                        nofollow=False,
                    ),
                    Link(
                        url="http://google.com/something",
                        text="External link not to follow",
                        nofollow=True,
                    ),
                ],
            )

/testbed/tests/test_linkextractors.py:626: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/linkextractors/lxmlhtml.py:88: in extract_links
    base_url = get_base_url(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <200 http://example.com/index.xhtml>

    def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
        """Return the base url of the given response, joined with the response url"""
        if response not in _baseurl_cache:
>           text = response.text[0:4096]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/utils/response.py:26: TypeError

test_loader.py::SelectortemLoaderTest::test_add_css_re

test_loader.py::SelectortemLoaderTest::test_add_css_re
self = 

    def test_add_css_re(self):
>       l = TestItemLoader(response=self.response)

/testbed/tests/test_loader.py:394: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/loader/__init__.py:87: in __init__
    selector = self.default_selector_class(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'Selector' object has no attribute 'type'") raised in repr()] Selector object at 0x7fcb95f93f50>
response = <200 >, text = None, type = None
root = , kwargs = {}

    def __init__(self, response: Optional[TextResponse]=None, text: Optional[str]=None, type: Optional[str]=None, root: Optional[Any]=_NOT_SET, **kwargs: Any):
        if response is not None and text is not None:
            raise ValueError(f'{self.__class__.__name__}.__init__() received both response and text')
>       st = _st(response, type)
E       NameError: name '_st' is not defined

/testbed/scrapy/selector/unified.py:55: NameError


test_loader.py::SelectortemLoaderTest::test_add_xpath_re

test_loader.py::SelectortemLoaderTest::test_add_xpath_re
self = 

    def test_add_xpath_re(self):
>       l = TestItemLoader(response=self.response)

/testbed/tests/test_loader.py:353: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/loader/__init__.py:87: in __init__
    selector = self.default_selector_class(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'Selector' object has no attribute 'type'") raised in repr()] Selector object at 0x7fcb95f93700>
response = <200 >, text = None, type = None
root = , kwargs = {}

    def __init__(self, response: Optional[TextResponse]=None, text: Optional[str]=None, type: Optional[str]=None, root: Optional[Any]=_NOT_SET, **kwargs: Any):
        if response is not None and text is not None:
            raise ValueError(f'{self.__class__.__name__}.__init__() received both response and text')
>       st = _st(response, type)
E       NameError: name '_st' is not defined

/testbed/scrapy/selector/unified.py:55: NameError


test_loader.py::SelectortemLoaderTest::test_get_css

test_loader.py::SelectortemLoaderTest::test_get_css
self = 

    def test_get_css(self):
>       l = TestItemLoader(response=self.response)

/testbed/tests/test_loader.py:418: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/loader/__init__.py:87: in __init__
    selector = self.default_selector_class(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'Selector' object has no attribute 'type'") raised in repr()] Selector object at 0x7fcb95bc6dd0>
response = <200 >, text = None, type = None
root = , kwargs = {}

    def __init__(self, response: Optional[TextResponse]=None, text: Optional[str]=None, type: Optional[str]=None, root: Optional[Any]=_NOT_SET, **kwargs: Any):
        if response is not None and text is not None:
            raise ValueError(f'{self.__class__.__name__}.__init__() received both response and text')
>       st = _st(response, type)
E       NameError: name '_st' is not defined

/testbed/scrapy/selector/unified.py:55: NameError


test_loader.py::SelectortemLoaderTest::test_get_xpath

test_loader.py::SelectortemLoaderTest::test_get_xpath
self = 

    def test_get_xpath(self):
>       l = TestItemLoader(response=self.response)

/testbed/tests/test_loader.py:369: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/loader/__init__.py:87: in __init__
    selector = self.default_selector_class(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'Selector' object has no attribute 'type'") raised in repr()] Selector object at 0x7fcb95bc69e0>
response = <200 >, text = None, type = None
root = , kwargs = {}

    def __init__(self, response: Optional[TextResponse]=None, text: Optional[str]=None, type: Optional[str]=None, root: Optional[Any]=_NOT_SET, **kwargs: Any):
        if response is not None and text is not None:
            raise ValueError(f'{self.__class__.__name__}.__init__() received both response and text')
>       st = _st(response, type)
E       NameError: name '_st' is not defined

/testbed/scrapy/selector/unified.py:55: NameError


test_loader.py::SelectortemLoaderTest::test_init_method_with_base_response

test_loader.py::SelectortemLoaderTest::test_init_method_with_base_response
self = 

    def test_init_method_with_base_response(self):
        """Selector should be None after initialization"""
        response = Response("https://scrapy.org")
>       l = TestItemLoader(response=response)

/testbed/tests/test_loader.py:323: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/loader/__init__.py:87: in __init__
    selector = self.default_selector_class(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'Selector' object has no attribute 'type'") raised in repr()] Selector object at 0x7fcb95bc6ac0>
response = <200 https://scrapy.org>, text = None, type = None
root = , kwargs = {}

    def __init__(self, response: Optional[TextResponse]=None, text: Optional[str]=None, type: Optional[str]=None, root: Optional[Any]=_NOT_SET, **kwargs: Any):
        if response is not None and text is not None:
            raise ValueError(f'{self.__class__.__name__}.__init__() received both response and text')
>       st = _st(response, type)
E       NameError: name '_st' is not defined

/testbed/scrapy/selector/unified.py:55: NameError


test_loader.py::SelectortemLoaderTest::test_init_method_with_response

test_loader.py::SelectortemLoaderTest::test_init_method_with_response
self = 

    def test_init_method_with_response(self):
>       l = TestItemLoader(response=self.response)

/testbed/tests/test_loader.py:327: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/loader/__init__.py:87: in __init__
    selector = self.default_selector_class(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'Selector' object has no attribute 'type'") raised in repr()] Selector object at 0x7fcb95bc7230>
response = <200 >, text = None, type = None
root = , kwargs = {}

    def __init__(self, response: Optional[TextResponse]=None, text: Optional[str]=None, type: Optional[str]=None, root: Optional[Any]=_NOT_SET, **kwargs: Any):
        if response is not None and text is not None:
            raise ValueError(f'{self.__class__.__name__}.__init__() received both response and text')
>       st = _st(response, type)
E       NameError: name '_st' is not defined

/testbed/scrapy/selector/unified.py:55: NameError


test_loader.py::SelectortemLoaderTest::test_init_method_with_response_css

test_loader.py::SelectortemLoaderTest::test_init_method_with_response_css
self = 

    def test_init_method_with_response_css(self):
>       l = TestItemLoader(response=self.response)

/testbed/tests/test_loader.py:334: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/loader/__init__.py:87: in __init__
    selector = self.default_selector_class(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'Selector' object has no attribute 'type'") raised in repr()] Selector object at 0x7fcb95bc70e0>
response = <200 >, text = None, type = None
root = , kwargs = {}

    def __init__(self, response: Optional[TextResponse]=None, text: Optional[str]=None, type: Optional[str]=None, root: Optional[Any]=_NOT_SET, **kwargs: Any):
        if response is not None and text is not None:
            raise ValueError(f'{self.__class__.__name__}.__init__() received both response and text')
>       st = _st(response, type)
E       NameError: name '_st' is not defined

/testbed/scrapy/selector/unified.py:55: NameError


test_loader.py::SelectortemLoaderTest::test_init_method_with_selector

test_loader.py::SelectortemLoaderTest::test_init_method_with_selector
self = 

    def test_init_method_with_selector(self):
>       sel = Selector(text="
marta
") /testbed/tests/test_loader.py:305: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Selector' object has no attribute 'type'") raised in repr()] Selector object at 0x7fcb95bc6eb0> response = None, text = '
marta
' type = None, root = , kwargs = {} def __init__(self, response: Optional[TextResponse]=None, text: Optional[str]=None, type: Optional[str]=None, root: Optional[Any]=_NOT_SET, **kwargs: Any): if response is not None and text is not None: raise ValueError(f'{self.__class__.__name__}.__init__() received both response and text') > st = _st(response, type) E NameError: name '_st' is not defined /testbed/scrapy/selector/unified.py:55: NameError

test_loader.py::SelectortemLoaderTest::test_init_method_with_selector_css

test_loader.py::SelectortemLoaderTest::test_init_method_with_selector_css
self = 

    def test_init_method_with_selector_css(self):
>       sel = Selector(text="
marta
") /testbed/tests/test_loader.py:313: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Selector' object has no attribute 'type'") raised in repr()] Selector object at 0x7fcb95bc6b30> response = None, text = '
marta
' type = None, root = , kwargs = {} def __init__(self, response: Optional[TextResponse]=None, text: Optional[str]=None, type: Optional[str]=None, root: Optional[Any]=_NOT_SET, **kwargs: Any): if response is not None and text is not None: raise ValueError(f'{self.__class__.__name__}.__init__() received both response and text') > st = _st(response, type) E NameError: name '_st' is not defined /testbed/scrapy/selector/unified.py:55: NameError

test_loader.py::SelectortemLoaderTest::test_replace_css

test_loader.py::SelectortemLoaderTest::test_replace_css
self = 

    def test_replace_css(self):
>       l = TestItemLoader(response=self.response)

/testbed/tests/test_loader.py:402: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/loader/__init__.py:87: in __init__
    selector = self.default_selector_class(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'Selector' object has no attribute 'type'") raised in repr()] Selector object at 0x7fcb95bc6e40>
response = <200 >, text = None, type = None
root = , kwargs = {}

    def __init__(self, response: Optional[TextResponse]=None, text: Optional[str]=None, type: Optional[str]=None, root: Optional[Any]=_NOT_SET, **kwargs: Any):
        if response is not None and text is not None:
            raise ValueError(f'{self.__class__.__name__}.__init__() received both response and text')
>       st = _st(response, type)
E       NameError: name '_st' is not defined

/testbed/scrapy/selector/unified.py:55: NameError


test_loader.py::SelectortemLoaderTest::test_replace_css_multi_fields

test_loader.py::SelectortemLoaderTest::test_replace_css_multi_fields
self = 

    def test_replace_css_multi_fields(self):
>       l = TestItemLoader(response=self.response)

/testbed/tests/test_loader.py:430: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/loader/__init__.py:87: in __init__
    selector = self.default_selector_class(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'Selector' object has no attribute 'type'") raised in repr()] Selector object at 0x7fcb95bc6890>
response = <200 >, text = None, type = None
root = , kwargs = {}

    def __init__(self, response: Optional[TextResponse]=None, text: Optional[str]=None, type: Optional[str]=None, root: Optional[Any]=_NOT_SET, **kwargs: Any):
        if response is not None and text is not None:
            raise ValueError(f'{self.__class__.__name__}.__init__() received both response and text')
>       st = _st(response, type)
E       NameError: name '_st' is not defined

/testbed/scrapy/selector/unified.py:55: NameError


test_loader.py::SelectortemLoaderTest::test_replace_css_re

test_loader.py::SelectortemLoaderTest::test_replace_css_re
self = 

    def test_replace_css_re(self):
>       l = TestItemLoader(response=self.response)

/testbed/tests/test_loader.py:442: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/loader/__init__.py:87: in __init__
    selector = self.default_selector_class(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'Selector' object has no attribute 'type'") raised in repr()] Selector object at 0x7fcb962afe00>
response = <200 >, text = None, type = None
root = , kwargs = {}

    def __init__(self, response: Optional[TextResponse]=None, text: Optional[str]=None, type: Optional[str]=None, root: Optional[Any]=_NOT_SET, **kwargs: Any):
        if response is not None and text is not None:
            raise ValueError(f'{self.__class__.__name__}.__init__() received both response and text')
>       st = _st(response, type)
E       NameError: name '_st' is not defined

/testbed/scrapy/selector/unified.py:55: NameError


test_loader.py::SelectortemLoaderTest::test_replace_xpath

test_loader.py::SelectortemLoaderTest::test_replace_xpath
self = 

    def test_replace_xpath(self):
>       l = TestItemLoader(response=self.response)

/testbed/tests/test_loader.py:358: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/loader/__init__.py:87: in __init__
    selector = self.default_selector_class(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'Selector' object has no attribute 'type'") raised in repr()] Selector object at 0x7fcb95bc73f0>
response = <200 >, text = None, type = None
root = , kwargs = {}

    def __init__(self, response: Optional[TextResponse]=None, text: Optional[str]=None, type: Optional[str]=None, root: Optional[Any]=_NOT_SET, **kwargs: Any):
        if response is not None and text is not None:
            raise ValueError(f'{self.__class__.__name__}.__init__() received both response and text')
>       st = _st(response, type)
E       NameError: name '_st' is not defined

/testbed/scrapy/selector/unified.py:55: NameError


test_loader.py::SelectortemLoaderTest::test_replace_xpath_multi_fields

test_loader.py::SelectortemLoaderTest::test_replace_xpath_multi_fields
self = 

    def test_replace_xpath_multi_fields(self):
>       l = TestItemLoader(response=self.response)

/testbed/tests/test_loader.py:379: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/loader/__init__.py:87: in __init__
    selector = self.default_selector_class(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'Selector' object has no attribute 'type'") raised in repr()] Selector object at 0x7fcb95bc7460>
response = <200 >, text = None, type = None
root = , kwargs = {}

    def __init__(self, response: Optional[TextResponse]=None, text: Optional[str]=None, type: Optional[str]=None, root: Optional[Any]=_NOT_SET, **kwargs: Any):
        if response is not None and text is not None:
            raise ValueError(f'{self.__class__.__name__}.__init__() received both response and text')
>       st = _st(response, type)
E       NameError: name '_st' is not defined

/testbed/scrapy/selector/unified.py:55: NameError


test_loader.py::SelectortemLoaderTest::test_replace_xpath_re

test_loader.py::SelectortemLoaderTest::test_replace_xpath_re
self = 

    def test_replace_xpath_re(self):
>       l = TestItemLoader(response=self.response)

/testbed/tests/test_loader.py:386: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/loader/__init__.py:87: in __init__
    selector = self.default_selector_class(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'Selector' object has no attribute 'type'") raised in repr()] Selector object at 0x7fcb95bc7620>
response = <200 >, text = None, type = None
root = , kwargs = {}

    def __init__(self, response: Optional[TextResponse]=None, text: Optional[str]=None, type: Optional[str]=None, root: Optional[Any]=_NOT_SET, **kwargs: Any):
        if response is not None and text is not None:
            raise ValueError(f'{self.__class__.__name__}.__init__() received both response and text')
>       st = _st(response, type)
E       NameError: name '_st' is not defined

/testbed/scrapy/selector/unified.py:55: NameError


test_loader.py::SubselectorLoaderTest::test_nested_css

test_loader.py::SubselectorLoaderTest::test_nested_css
self = 

    def test_nested_css(self):
>       l = NestedItemLoader(response=self.response)

/testbed/tests/test_loader.py:491: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/loader/__init__.py:87: in __init__
    selector = self.default_selector_class(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'Selector' object has no attribute 'type'") raised in repr()] Selector object at 0x7fcb95f938c0>
response = <200 >, text = None, type = None
root = , kwargs = {}

    def __init__(self, response: Optional[TextResponse]=None, text: Optional[str]=None, type: Optional[str]=None, root: Optional[Any]=_NOT_SET, **kwargs: Any):
        if response is not None and text is not None:
            raise ValueError(f'{self.__class__.__name__}.__init__() received both response and text')
>       st = _st(response, type)
E       NameError: name '_st' is not defined

/testbed/scrapy/selector/unified.py:55: NameError


test_loader.py::SubselectorLoaderTest::test_nested_load_item

test_loader.py::SubselectorLoaderTest::test_nested_load_item
self = 

    def test_nested_load_item(self):
>       l = NestedItemLoader(response=self.response)

/testbed/tests/test_loader.py:542: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/loader/__init__.py:87: in __init__
    selector = self.default_selector_class(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'Selector' object has no attribute 'type'") raised in repr()] Selector object at 0x7fcb962afe00>
response = <200 >, text = None, type = None
root = , kwargs = {}

    def __init__(self, response: Optional[TextResponse]=None, text: Optional[str]=None, type: Optional[str]=None, root: Optional[Any]=_NOT_SET, **kwargs: Any):
        if response is not None and text is not None:
            raise ValueError(f'{self.__class__.__name__}.__init__() received both response and text')
>       st = _st(response, type)
E       NameError: name '_st' is not defined

/testbed/scrapy/selector/unified.py:55: NameError


test_loader.py::SubselectorLoaderTest::test_nested_ordering

test_loader.py::SubselectorLoaderTest::test_nested_ordering
self = 

    def test_nested_ordering(self):
>       l = NestedItemLoader(response=self.response)

/testbed/tests/test_loader.py:522: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/loader/__init__.py:87: in __init__
    selector = self.default_selector_class(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'Selector' object has no attribute 'type'") raised in repr()] Selector object at 0x7fcb9603ef90>
response = <200 >, text = None, type = None
root = , kwargs = {}

    def __init__(self, response: Optional[TextResponse]=None, text: Optional[str]=None, type: Optional[str]=None, root: Optional[Any]=_NOT_SET, **kwargs: Any):
        if response is not None and text is not None:
            raise ValueError(f'{self.__class__.__name__}.__init__() received both response and text')
>       st = _st(response, type)
E       NameError: name '_st' is not defined

/testbed/scrapy/selector/unified.py:55: NameError


test_loader.py::SubselectorLoaderTest::test_nested_replace

test_loader.py::SubselectorLoaderTest::test_nested_replace
self = 

    def test_nested_replace(self):
>       l = NestedItemLoader(response=self.response)

/testbed/tests/test_loader.py:510: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/loader/__init__.py:87: in __init__
    selector = self.default_selector_class(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'Selector' object has no attribute 'type'") raised in repr()] Selector object at 0x7fcb95f93850>
response = <200 >, text = None, type = None
root = , kwargs = {}

    def __init__(self, response: Optional[TextResponse]=None, text: Optional[str]=None, type: Optional[str]=None, root: Optional[Any]=_NOT_SET, **kwargs: Any):
        if response is not None and text is not None:
            raise ValueError(f'{self.__class__.__name__}.__init__() received both response and text')
>       st = _st(response, type)
E       NameError: name '_st' is not defined

/testbed/scrapy/selector/unified.py:55: NameError


test_loader.py::SubselectorLoaderTest::test_nested_xpath

test_loader.py::SubselectorLoaderTest::test_nested_xpath
self = 

    def test_nested_xpath(self):
>       l = NestedItemLoader(response=self.response)

/testbed/tests/test_loader.py:471: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/loader/__init__.py:87: in __init__
    selector = self.default_selector_class(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'Selector' object has no attribute 'type'") raised in repr()] Selector object at 0x7fcb95f93700>
response = <200 >, text = None, type = None
root = , kwargs = {}

    def __init__(self, response: Optional[TextResponse]=None, text: Optional[str]=None, type: Optional[str]=None, root: Optional[Any]=_NOT_SET, **kwargs: Any):
        if response is not None and text is not None:
            raise ValueError(f'{self.__class__.__name__}.__init__() received both response and text')
>       st = _st(response, type)
E       NameError: name '_st' is not defined

/testbed/scrapy/selector/unified.py:55: NameError


test_loader_deprecated.py::DeprecatedUtilityFunctionsTestCase::test_deprecated_extract_regex

test_loader_deprecated.py::DeprecatedUtilityFunctionsTestCase::test_deprecated_extract_regex
self = 

    def test_deprecated_extract_regex(self):
        with warnings.catch_warnings(record=True) as w:
            extract_regex(r"\w+", "this is a test")

>           assert len(w) == 1
E           AssertionError

/testbed/tests/test_loader_deprecated.py:740: AssertionError

test_loader_deprecated.py::DeprecatedUtilityFunctionsTestCase::test_deprecated_wrap_loader_context

test_loader_deprecated.py::DeprecatedUtilityFunctionsTestCase::test_deprecated_wrap_loader_context
self = 

    def test_deprecated_wrap_loader_context(self):
        def function(*args):
            return None

        with warnings.catch_warnings(record=True) as w:
            wrap_loader_context(function, context={})

>           assert len(w) == 1
E           AssertionError

/testbed/tests/test_loader_deprecated.py:733: AssertionError

test_mail.py::MailSenderTest::test_create_sender_factory_with_host

test_mail.py::MailSenderTest::test_create_sender_factory_with_host
self = 

    def test_create_sender_factory_with_host(self):
>       mailsender = MailSender(debug=False, smtphost="smtp.testhost.com")

/testbed/tests/test_mail.py:155: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
smtphost = 'smtp.testhost.com', mailfrom = 'scrapy@localhost', smtpuser = None
smtppass = None, smtpport = 25, smtptls = False, smtpssl = False, debug = False

    def __init__(self, smtphost='localhost', mailfrom='scrapy@localhost', smtpuser=None, smtppass=None, smtpport=25, smtptls=False, smtpssl=False, debug=False):
        self.smtphost = smtphost
        self.smtpport = smtpport
>       self.smtpuser = _to_bytes_or_none(smtpuser)
E       NameError: name '_to_bytes_or_none' is not defined

/testbed/scrapy/mail.py:27: NameError

test_mail.py::MailSenderTest::test_send

test_mail.py::MailSenderTest::test_send
self = 

    def test_send(self):
>       mailsender = MailSender(debug=True)

/testbed/tests/test_mail.py:16: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = , smtphost = 'localhost'
mailfrom = 'scrapy@localhost', smtpuser = None, smtppass = None, smtpport = 25
smtptls = False, smtpssl = False, debug = True

    def __init__(self, smtphost='localhost', mailfrom='scrapy@localhost', smtpuser=None, smtppass=None, smtpport=25, smtptls=False, smtpssl=False, debug=False):
        self.smtphost = smtphost
        self.smtpport = smtpport
>       self.smtpuser = _to_bytes_or_none(smtpuser)
E       NameError: name '_to_bytes_or_none' is not defined

/testbed/scrapy/mail.py:27: NameError

test_mail.py::MailSenderTest::test_send_attach

test_mail.py::MailSenderTest::test_send_attach
self = 

    def test_send_attach(self):
        attach = BytesIO()
        attach.write(b"content")
        attach.seek(0)
        attachs = [("attachment", "text/plain", attach)]

>       mailsender = MailSender(debug=True)

/testbed/tests/test_mail.py:66: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = , smtphost = 'localhost'
mailfrom = 'scrapy@localhost', smtpuser = None, smtppass = None, smtpport = 25
smtptls = False, smtpssl = False, debug = True

    def __init__(self, smtphost='localhost', mailfrom='scrapy@localhost', smtpuser=None, smtppass=None, smtpport=25, smtptls=False, smtpssl=False, debug=False):
        self.smtphost = smtphost
        self.smtpport = smtpport
>       self.smtpuser = _to_bytes_or_none(smtpuser)
E       NameError: name '_to_bytes_or_none' is not defined

/testbed/scrapy/mail.py:27: NameError

test_mail.py::MailSenderTest::test_send_attach_utf8

test_mail.py::MailSenderTest::test_send_attach_utf8
self = 

    def test_send_attach_utf8(self):
        subject = "sübjèçt"
        body = "bödÿ-àéïöñß"
        attach = BytesIO()
        attach.write(body.encode("utf-8"))
        attach.seek(0)
        attachs = [("attachment", "text/plain", attach)]

>       mailsender = MailSender(debug=True)

/testbed/tests/test_mail.py:126: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = , smtphost = 'localhost'
mailfrom = 'scrapy@localhost', smtpuser = None, smtppass = None, smtpport = 25
smtptls = False, smtpssl = False, debug = True

    def __init__(self, smtphost='localhost', mailfrom='scrapy@localhost', smtpuser=None, smtppass=None, smtpport=25, smtptls=False, smtpssl=False, debug=False):
        self.smtphost = smtphost
        self.smtpport = smtpport
>       self.smtpuser = _to_bytes_or_none(smtpuser)
E       NameError: name '_to_bytes_or_none' is not defined

/testbed/scrapy/mail.py:27: NameError

test_mail.py::MailSenderTest::test_send_html

test_mail.py::MailSenderTest::test_send_html
self = 

    def test_send_html(self):
>       mailsender = MailSender(debug=True)

/testbed/tests/test_mail.py:47: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = , smtphost = 'localhost'
mailfrom = 'scrapy@localhost', smtpuser = None, smtppass = None, smtpport = 25
smtptls = False, smtpssl = False, debug = True

    def __init__(self, smtphost='localhost', mailfrom='scrapy@localhost', smtpuser=None, smtppass=None, smtpport=25, smtptls=False, smtpssl=False, debug=False):
        self.smtphost = smtphost
        self.smtpport = smtpport
>       self.smtpuser = _to_bytes_or_none(smtpuser)
E       NameError: name '_to_bytes_or_none' is not defined

/testbed/scrapy/mail.py:27: NameError

test_mail.py::MailSenderTest::test_send_single_values_to_and_cc

test_mail.py::MailSenderTest::test_send_single_values_to_and_cc
self = 

    def test_send_single_values_to_and_cc(self):
>       mailsender = MailSender(debug=True)

/testbed/tests/test_mail.py:37: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = , smtphost = 'localhost'
mailfrom = 'scrapy@localhost', smtpuser = None, smtppass = None, smtpport = 25
smtptls = False, smtpssl = False, debug = True

    def __init__(self, smtphost='localhost', mailfrom='scrapy@localhost', smtpuser=None, smtppass=None, smtpport=25, smtptls=False, smtpssl=False, debug=False):
        self.smtphost = smtphost
        self.smtpport = smtpport
>       self.smtpuser = _to_bytes_or_none(smtpuser)
E       NameError: name '_to_bytes_or_none' is not defined

/testbed/scrapy/mail.py:27: NameError

test_mail.py::MailSenderTest::test_send_utf8

test_mail.py::MailSenderTest::test_send_utf8
self = 

    def test_send_utf8(self):
        subject = "sübjèçt"
        body = "bödÿ-àéïöñß"
>       mailsender = MailSender(debug=True)

/testbed/tests/test_mail.py:99: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = , smtphost = 'localhost'
mailfrom = 'scrapy@localhost', smtpuser = None, smtppass = None, smtpport = 25
smtptls = False, smtpssl = False, debug = True

    def __init__(self, smtphost='localhost', mailfrom='scrapy@localhost', smtpuser=None, smtppass=None, smtpport=25, smtptls=False, smtpssl=False, debug=False):
        self.smtphost = smtphost
        self.smtpport = smtpport
>       self.smtpuser = _to_bytes_or_none(smtpuser)
E       NameError: name '_to_bytes_or_none' is not defined

/testbed/scrapy/mail.py:27: NameError

test_middleware.py::MiddlewareManagerTest::test_enabled

test_middleware.py::MiddlewareManagerTest::test_enabled
self = 

    def test_enabled(self):
        m1, m2, m3 = M1(), M2(), M3()
>       mwman = MiddlewareManager(m1, m2, m3)

/testbed/tests/test_middleware.py:82: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
middlewares = (, , )
mw = 

    def __init__(self, *middlewares: Any) -> None:
        self.middlewares = middlewares
        self.methods: Dict[str, Deque[Union[None, Callable, Tuple[Callable, Callable]]]] = defaultdict(deque)
        for mw in middlewares:
>           self._add_middleware(mw)
E           AttributeError: 'MiddlewareManager' object has no attribute '_add_middleware'

/testbed/scrapy/middleware.py:25: AttributeError

test_middleware.py::MiddlewareManagerTest::test_enabled_from_settings

test_middleware.py::MiddlewareManagerTest::test_enabled_from_settings
self = 

    def test_enabled_from_settings(self):
        settings = Settings()
>       mwman = TestMiddlewareManager.from_settings(settings)
E       AttributeError: type object 'TestMiddlewareManager' has no attribute 'from_settings'

/testbed/tests/test_middleware.py:87: AttributeError

test_middleware.py::MiddlewareManagerTest::test_init

test_middleware.py::MiddlewareManagerTest::test_init
self = 

    def test_init(self):
        m1, m2, m3 = M1(), M2(), M3()
>       mwman = TestMiddlewareManager(m1, m2, m3)

/testbed/tests/test_middleware.py:59: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/middleware.py:25: in __init__
    self._add_middleware(mw)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
mw = 

    def _add_middleware(self, mw):
>       super()._add_middleware(mw)
E       AttributeError: 'super' object has no attribute '_add_middleware'

/testbed/tests/test_middleware.py:51: AttributeError

test_middleware.py::MiddlewareManagerTest::test_methods

test_middleware.py::MiddlewareManagerTest::test_methods
self = 

    def test_methods(self):
>       mwman = TestMiddlewareManager(M1(), M2(), M3())

/testbed/tests/test_middleware.py:69: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/middleware.py:25: in __init__
    self._add_middleware(mw)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
mw = 

    def _add_middleware(self, mw):
>       super()._add_middleware(mw)
E       AttributeError: 'super' object has no attribute '_add_middleware'

/testbed/tests/test_middleware.py:51: AttributeError

test_request_dict.py::RequestSerializationTest::test_callback_not_available

test_request_dict.py::RequestSerializationTest::test_callback_not_available
self = 

    def test_callback_not_available(self):
        """Callback method is not available in the spider passed to from_dict"""
        spider = TestSpiderDelegation()
        r = Request("http://www.example.com", callback=spider.delegated_callback)
        d = r.to_dict(spider=spider)
>       self.assertRaises(ValueError, request_from_dict, d, spider=Spider("foo"))

/testbed/tests/test_request_dict.py:158: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/utils/request.py:193: in request_from_dict
    d['callback'] = _get_method(spider, callback)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def _get_method(obj: Any, name: Any) -> Any:
        """Helper function for request_from_dict"""
        if isinstance(name, str):
>           return getattr(obj, name)
E           AttributeError: 'Spider' object has no attribute 'delegated_callback'

/testbed/scrapy/utils/request.py:202: AttributeError

test_request_dict.py::RequestSerializationTest::test_request_class

test_request_dict.py::RequestSerializationTest::test_request_class
self = 

    def test_request_class(self):
        r1 = FormRequest("http://www.example.com")
>       self._assert_serializes_ok(r1, spider=self.spider)

/testbed/tests/test_request_dict.py:71: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_request_dict.py:47: in _assert_serializes_ok
    request2 = request_from_dict(d, spider=spider)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

d = {'_class': 'scrapy.http.request.form.FormRequest', 'body': b'', 'cb_kwargs': {}, 'cookies': {}, ...}

    def request_from_dict(d: dict, *, spider: Optional[Spider]=None) -> Request:
        """Create a :class:`~scrapy.Request` object from a dict.

        If a spider is given, it will try to resolve the callbacks looking at the
        spider for methods with the same name.
        """
        d = d.copy()
        callback = d.pop('callback', None)
        errback = d.pop('errback', None)
        cls = load_object(d.pop('cls')) if 'cls' in d else Request

        if callback and spider:
            d['callback'] = _get_method(spider, callback)
        if errback and spider:
            d['errback'] = _get_method(spider, errback)

>       return cls(**d)
E       TypeError: Request.__init__() got an unexpected keyword argument '_class'

/testbed/scrapy/utils/request.py:197: TypeError

test_responsetypes.py::ResponseTypesTest::test_from_args

test_responsetypes.py::ResponseTypesTest::test_from_args
self = 

    def test_from_args(self):
        # TODO: add more tests that check precedence between the different arguments
        mappings = [
            ({"url": "http://www.example.com/data.csv"}, TextResponse),
            # headers takes precedence over url
            (
                {
                    "headers": Headers({"Content-Type": ["text/html; charset=utf-8"]}),
                    "url": "http://www.example.com/item/",
                },
                HtmlResponse,
            ),
            (
                {
                    "headers": Headers(
                        {"Content-Disposition": ['attachment; filename="data.xml.gz"']}
                    ),
                    "url": "http://www.example.com/page/",
                },
                Response,
            ),
        ]
        for source, cls in mappings:
            retcls = responsetypes.from_args(**source)
>           assert retcls is cls, f"{source} ==> {retcls} != {cls}"
E           AssertionError: {'url': 'http://www.example.com/data.csv'} ==> None != 

/testbed/tests/test_responsetypes.py:111: AssertionError

test_responsetypes.py::ResponseTypesTest::test_from_body

test_responsetypes.py::ResponseTypesTest::test_from_body
self = 

    def test_from_body(self):
        mappings = [
            (b"\x03\x02\xdf\xdd\x23", Response),
            (b"Some plain text\ndata with tabs\t and null bytes\0", TextResponse),
            (b"Hello", HtmlResponse),
            # https://codersblock.com/blog/the-smallest-valid-html5-page/
            (b"\n.", HtmlResponse),
            (b'           assert retcls is cls, f"{source} ==> {retcls} != {cls}"
E           AssertionError: b'\x03\x02\xdf\xdd#' ==> None != 

/testbed/tests/test_responsetypes.py:62: AssertionError

test_responsetypes.py::ResponseTypesTest::test_from_content_disposition

test_responsetypes.py::ResponseTypesTest::test_from_content_disposition
self = 

    def test_from_content_disposition(self):
        mappings = [
            (b'attachment; filename="data.xml"', XmlResponse),
            (b"attachment; filename=data.xml", XmlResponse),
            ("attachment;filename=data£.tar.gz".encode("utf-8"), Response),
            ("attachment;filename=dataµ.tar.gz".encode("latin-1"), Response),
            ("attachment;filename=data高.doc".encode("gbk"), Response),
            ("attachment;filename=دورهdata.html".encode("cp720"), HtmlResponse),
            ("attachment;filename=日本語版Wikipedia.xml".encode("iso2022_jp"), XmlResponse),
        ]
        for source, cls in mappings:
>           retcls = responsetypes.from_content_disposition(source)
E           AttributeError: 'ResponseTypes' object has no attribute 'from_content_disposition'

/testbed/tests/test_responsetypes.py:32: AttributeError

test_responsetypes.py::ResponseTypesTest::test_from_content_type

test_responsetypes.py::ResponseTypesTest::test_from_content_type
self = 

    def test_from_content_type(self):
        mappings = [
            ("text/html; charset=UTF-8", HtmlResponse),
            ("text/xml; charset=UTF-8", XmlResponse),
            ("application/xhtml+xml; charset=UTF-8", HtmlResponse),
            ("application/vnd.wap.xhtml+xml; charset=utf-8", HtmlResponse),
            ("application/xml; charset=UTF-8", XmlResponse),
            ("application/octet-stream", Response),
            ("application/x-json; encoding=UTF8;charset=UTF-8", TextResponse),
            ("application/json-amazonui-streaming;charset=UTF-8", TextResponse),
            (b"application/x-download; filename=\x80dummy.txt", Response),
        ]
        for source, cls in mappings:
            retcls = responsetypes.from_content_type(source)
>           assert retcls is cls, f"{source} ==> {retcls} != {cls}"
E           AssertionError: text/html; charset=UTF-8 ==> None != 

/testbed/tests/test_responsetypes.py:49: AssertionError

test_responsetypes.py::ResponseTypesTest::test_from_filename

test_responsetypes.py::ResponseTypesTest::test_from_filename
self = 

    def test_from_filename(self):
        mappings = [
            ("data.bin", Response),
            ("file.txt", TextResponse),
            ("file.xml.gz", Response),
            ("file.xml", XmlResponse),
            ("file.html", HtmlResponse),
            ("file.unknownext", Response),
        ]
        for source, cls in mappings:
            retcls = responsetypes.from_filename(source)
>           assert retcls is cls, f"{source} ==> {retcls} != {cls}"
E           AssertionError: data.bin ==> None != 

/testbed/tests/test_responsetypes.py:19: AssertionError

test_responsetypes.py::ResponseTypesTest::test_from_headers

test_responsetypes.py::ResponseTypesTest::test_from_headers
self = 

    def test_from_headers(self):
        mappings = [
            ({"Content-Type": ["text/html; charset=utf-8"]}, HtmlResponse),
            (
                {
                    "Content-Type": ["text/html; charset=utf-8"],
                    "Content-Encoding": ["gzip"],
                },
                Response,
            ),
            (
                {
                    "Content-Type": ["application/octet-stream"],
                    "Content-Disposition": ["attachment; filename=data.txt"],
                },
                TextResponse,
            ),
        ]
        for source, cls in mappings:
            source = Headers(source)
            retcls = responsetypes.from_headers(source)
>           assert retcls is cls, f"{source} ==> {retcls} != {cls}"
E           AssertionError: {'Content-Type': ['text/html; charset=utf-8']} ==> None != 

/testbed/tests/test_responsetypes.py:85: AssertionError

test_selector.py::SelectorTestCase::test_badly_encoded_body

test_selector.py::SelectorTestCase::test_badly_encoded_body
self = 

    def test_badly_encoded_body(self):
        # \xe9 alone isn't valid utf8 sequence
        r1 = TextResponse(
            "http://www.example.com",
            body=b"

an Jos\xe9 de

", encoding="utf-8", ) > Selector(r1).xpath("//text()").getall() /testbed/tests/test_selector.py:104: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Selector' object has no attribute 'type'") raised in repr()] Selector object at 0x7fcb95c83cb0> response = <200 http://www.example.com>, text = None, type = None root = , kwargs = {} def __init__(self, response: Optional[TextResponse]=None, text: Optional[str]=None, type: Optional[str]=None, root: Optional[Any]=_NOT_SET, **kwargs: Any): if response is not None and text is not None: raise ValueError(f'{self.__class__.__name__}.__init__() received both response and text') > st = _st(response, type) E NameError: name '_st' is not defined /testbed/scrapy/selector/unified.py:55: NameError

test_selector.py::SelectorTestCase::test_flavor_detection

test_selector.py::SelectorTestCase::test_flavor_detection
self = 

    def test_flavor_detection(self):
        text = b'

Hello

' > sel = Selector(XmlResponse("http://example.com", body=text, encoding="utf-8")) /testbed/tests/test_selector.py:62: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Selector' object has no attribute 'type'") raised in repr()] Selector object at 0x7fcb95c83e00> response = <200 http://example.com>, text = None, type = None root = , kwargs = {} def __init__(self, response: Optional[TextResponse]=None, text: Optional[str]=None, type: Optional[str]=None, root: Optional[Any]=_NOT_SET, **kwargs: Any): if response is not None and text is not None: raise ValueError(f'{self.__class__.__name__}.__init__() received both response and text') > st = _st(response, type) E NameError: name '_st' is not defined /testbed/scrapy/selector/unified.py:55: NameError

test_selector.py::SelectorTestCase::test_http_header_encoding_precedence

test_selector.py::SelectorTestCase::test_http_header_encoding_precedence
self = 

    def test_http_header_encoding_precedence(self):
        # '\xa3'     = pound symbol in unicode
        # '\xc2\xa3' = pound symbol in utf-8
        # '\xa3'     = pound symbol in latin-1 (iso-8859-1)

        meta = (
            ''
        )
        head = "" + meta + ""
        body_content = '\xa3'
        body = "" + body_content + ""
        html = "" + head + body + ""
        encoding = "utf-8"
        html_utf8 = html.encode(encoding)

        headers = {"Content-Type": ["text/html; charset=utf-8"]}
        response = HtmlResponse(
            url="http://example.com", headers=headers, body=html_utf8
        )
>       x = Selector(response)

/testbed/tests/test_selector.py:94: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'Selector' object has no attribute 'type'") raised in repr()] Selector object at 0x7fcb95c83f50>
response = <200 http://example.com>, text = None, type = None
root = , kwargs = {}

    def __init__(self, response: Optional[TextResponse]=None, text: Optional[str]=None, type: Optional[str]=None, root: Optional[Any]=_NOT_SET, **kwargs: Any):
        if response is not None and text is not None:
            raise ValueError(f'{self.__class__.__name__}.__init__() received both response and text')
>       st = _st(response, type)
E       NameError: name '_st' is not defined

/testbed/scrapy/selector/unified.py:55: NameError


test_selector.py::SelectorTestCase::test_root_base_url

test_selector.py::SelectorTestCase::test_root_base_url
self = 

    def test_root_base_url(self):
        body = b'
' url = "http://example.com" response = TextResponse(url=url, body=body, encoding="utf-8") > sel = Selector(response) /testbed/tests/test_selector.py:57: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Selector' object has no attribute 'type'") raised in repr()] Selector object at 0x7fcb95c83150> response = <200 http://example.com>, text = None, type = None root = , kwargs = {} def __init__(self, response: Optional[TextResponse]=None, text: Optional[str]=None, type: Optional[str]=None, root: Optional[Any]=_NOT_SET, **kwargs: Any): if response is not None and text is not None: raise ValueError(f'{self.__class__.__name__}.__init__() received both response and text') > st = _st(response, type) E NameError: name '_st' is not defined /testbed/scrapy/selector/unified.py:55: NameError

test_selector.py::SelectorTestCase::test_simple_selection

test_selector.py::SelectorTestCase::test_simple_selection
self = 

    def test_simple_selection(self):
        """Simple selector tests"""
        body = b"

" response = TextResponse(url="http://example.com", body=body, encoding="utf-8") > sel = Selector(response) /testbed/tests/test_selector.py:20: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Selector' object has no attribute 'type'") raised in repr()] Selector object at 0x7fcb95c14590> response = <200 http://example.com>, text = None, type = None root = , kwargs = {} def __init__(self, response: Optional[TextResponse]=None, text: Optional[str]=None, type: Optional[str]=None, root: Optional[Any]=_NOT_SET, **kwargs: Any): if response is not None and text is not None: raise ValueError(f'{self.__class__.__name__}.__init__() received both response and text') > st = _st(response, type) E NameError: name '_st' is not defined /testbed/scrapy/selector/unified.py:55: NameError

test_selector.py::SelectorTestCase::test_weakref_slots

test_selector.py::SelectorTestCase::test_weakref_slots
self = 

    def test_weakref_slots(self):
        """Check that classes are using slots and are weak-referenceable"""
>       x = Selector(text="")

/testbed/tests/test_selector.py:108: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'Selector' object has no attribute 'type'") raised in repr()] Selector object at 0x7fcb95c14750>
response = None, text = '', type = None
root = , kwargs = {}

    def __init__(self, response: Optional[TextResponse]=None, text: Optional[str]=None, type: Optional[str]=None, root: Optional[Any]=_NOT_SET, **kwargs: Any):
        if response is not None and text is not None:
            raise ValueError(f'{self.__class__.__name__}.__init__() received both response and text')
>       st = _st(response, type)
E       NameError: name '_st' is not defined

/testbed/scrapy/selector/unified.py:55: NameError


test_selector.py::JMESPathTestCase::test_html_has_json

test_selector.py::JMESPathTestCase::test_html_has_json
self = 

    @pytest.mark.skipif(
        not PARSEL_18_PLUS, reason="parsel < 1.8 doesn't support jmespath"
    )
    def test_html_has_json(self) -> None:
        body = """
        

Information

{ "user": [ { "name": "A", "age": 18 }, { "name": "B", "age": 32 }, { "name": "C", "age": 22 }, { "name": "D", "age": 25 } ], "total": 4, "status": "ok" }
""" > resp = TextResponse(url="http://example.com", body=body, encoding="utf-8") /testbed/tests/test_selector.py:196: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'TextResponse' object has no attribute '_url'") raised in repr()] TextResponse object at 0x7fcb95c57f80> body = '\n
\n

Information

\n \n {\n "user": [\n ... "total": 4,\n "status": "ok"\n }\n \n
\n ' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_selector.py::JMESPathTestCase::test_jmestpath_with_re

test_selector.py::JMESPathTestCase::test_jmestpath_with_re
self = 

    @pytest.mark.skipif(
        not PARSEL_18_PLUS, reason="parsel < 1.8 doesn't support jmespath"
    )
    def test_jmestpath_with_re(self) -> None:
        body = """
            

Information

{ "user": [ { "name": "A", "age": 18 }, { "name": "B", "age": 32 }, { "name": "C", "age": 22 }, { "name": "D", "age": 25 } ], "total": 4, "status": "ok" }
""" > resp = TextResponse(url="http://example.com", body=body, encoding="utf-8") /testbed/tests/test_selector.py:240: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'TextResponse' object has no attribute '_url'") raised in repr()] TextResponse object at 0x7fcb95c54f50> body = '\n
\n

Information

\n \n {\n ... 4,\n "status": "ok"\n }\n \n
\n ' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

test_selector.py::JMESPathTestCase::test_json_has_html

test_selector.py::JMESPathTestCase::test_json_has_html
self = 

    @pytest.mark.skipif(
        not PARSEL_18_PLUS, reason="parsel < 1.8 doesn't support jmespath"
    )
    def test_json_has_html(self) -> None:
        """Sometimes the information is returned in a json wrapper"""

        body = """
        {
            "content": [
                {
                    "name": "A",
                    "value": "a"
                },
                {
                    "name": {
                        "age": 18
                    },
                    "value": "b"
                },
                {
                    "name": "C",
                    "value": "c"
                },
                {
                    "name": "D",
                    "value": "
d
" } ], "html": "
def
" } """ > resp = TextResponse(url="http://example.com", body=body, encoding="utf-8") /testbed/tests/test_selector.py:151: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /testbed/scrapy/http/response/text.py:33: in __init__ super().__init__(*args, **kwargs) /testbed/scrapy/http/response/__init__.py:55: in __init__ self._set_body(body) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'TextResponse' object has no attribute '_url'") raised in repr()] TextResponse object at 0x7fcb95c56780> body = '\n {\n "content": [\n {\n "name": "A",\n "valu... }\n ],\n "html": "
def
"\n }\n ' def _set_body(self, body): if body is None: self._body = b"" elif not isinstance(body, bytes): > raise TypeError( "Response body must be bytes. " "If you want to pass unicode body use TextResponse " "or HtmlResponse." ) E TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse. /testbed/scrapy/http/response/__init__.py:103: TypeError

init.py::BaseSettingsTest::test_update_iterable

__init__.py::BaseSettingsTest::test_update_iterable
self = 

    @pytest.mark.xfail(
        raises=AttributeError,
        reason="BaseSettings.update doesn't support iterable input",
    )
    def test_update_iterable(self):
        settings = BaseSettings({"key": 0})
>       settings.update([("key", 1)])

/testbed/tests/test_settings/__init__.py:217: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
values = [('key', 1)], priority = 'project'

    def update(self, values: _SettingsInputT, priority: Union[int, str] = "project") -> None:  # type: ignore[override]
        """
        Store key/value pairs with a given priority.

        This is a helper function that calls
        :meth:`~scrapy.settings.BaseSettings.set` for every item of ``values``
        with the provided ``priority``.

        If ``values`` is a string, it is assumed to be JSON-encoded and parsed
        into a dict with ``json.loads()`` first. If it is a
        :class:`~scrapy.settings.BaseSettings` instance, the per-key priorities
        will be used and the ``priority`` parameter ignored. This allows
        inserting/updating settings with different priorities with a single
        command.

        :param values: the settings names and values
        :type values: dict or string or :class:`~scrapy.settings.BaseSettings`

        :param priority: the priority of the settings. Should be a key of
            :attr:`~scrapy.settings.SETTINGS_PRIORITIES` or an integer
        :type priority: str or int
        """
        self._assert_mutability()
        if isinstance(values, str):
            values = cast(dict, json.loads(values))
        if values is not None:
            if isinstance(values, BaseSettings):
                for name, value in values.items():
                    self.set(name, value, cast(int, values.getpriority(name)))
            else:
>               for name, value in values.items():
E               AttributeError: 'list' object has no attribute 'items'

/testbed/scrapy/settings/__init__.py:421: AttributeError

init.py::BaseSettingsTest::test_update_kwargs

__init__.py::BaseSettingsTest::test_update_kwargs
self = 

    @pytest.mark.xfail(
        raises=TypeError, reason="BaseSettings.update doesn't support kwargs input"
    )
    def test_update_kwargs(self):
        settings = BaseSettings({"key": 0})
>       settings.update(key=1)  # pylint: disable=unexpected-keyword-arg
E       TypeError: BaseSettings.update() got an unexpected keyword argument 'key'

/testbed/tests/test_settings/__init__.py:209: TypeError

init.py::SettingsTest::test_passing_objects_as_values

__init__.py::SettingsTest::test_passing_objects_as_values
self = 

    def test_passing_objects_as_values(self):
        from scrapy.core.downloader.handlers.file import FileDownloadHandler
        from scrapy.utils.misc import create_instance
>       from scrapy.utils.test import get_crawler

/testbed/tests/test_settings/__init__.py:444: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/utils/test.py:14: in 
    from scrapy.crawler import Crawler
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    from __future__ import annotations
    import logging
    import pprint
    import signal
    import warnings
    from typing import TYPE_CHECKING, Any, Dict, Generator, Optional, Set, Type, Union, cast
    from twisted.internet.defer import Deferred, DeferredList, inlineCallbacks, maybeDeferred
    from zope.interface.exceptions import DoesNotImplement
    try:
        from zope.interface.exceptions import MultipleInvalid
    except ImportError:
        MultipleInvalid = None
    from zope.interface.verify import verifyClass
    from scrapy import Spider, signals
    from scrapy.addons import AddonManager
    from scrapy.core.engine import ExecutionEngine
    from scrapy.exceptions import ScrapyDeprecationWarning
    from scrapy.extension import ExtensionManager
    from scrapy.interfaces import ISpiderLoader
    from scrapy.logformatter import LogFormatter
    from scrapy.settings import BaseSettings, Settings, overridden_settings
    from scrapy.signalmanager import SignalManager
    from scrapy.statscollectors import StatsCollector
>   from scrapy.utils.log import LogCounterHandler, configure_logging, get_scrapy_root_handler, install_scrapy_root_handler, log_reactor_info, log_scrapy_info
E   ImportError: cannot import name 'get_scrapy_root_handler' from 'scrapy.utils.log' (/testbed/scrapy/utils/log.py)

/testbed/scrapy/crawler.py:24: ImportError

test_spidermiddleware_referer.py::TestRefererMiddleware::test

test_spidermiddleware_referer.py::TestRefererMiddleware::test
self = 

    def test(self):
        for origin, target, referrer in self.scenarii:
            response = self.get_response(origin)
            request = self.get_request(target)
>           out = list(self.mw.process_spider_output(response, [request], self.spider))
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:56: AttributeError

test_spidermiddleware_referer.py::TestRefererMiddlewareDefault::test

test_spidermiddleware_referer.py::TestRefererMiddlewareDefault::test
self = 

    def test(self):
        for origin, target, referrer in self.scenarii:
            response = self.get_response(origin)
            request = self.get_request(target)
>           out = list(self.mw.process_spider_output(response, [request], self.spider))
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:56: AttributeError

test_spidermiddleware_referer.py::TestSettingsNoReferrer::test

test_spidermiddleware_referer.py::TestSettingsNoReferrer::test
self = 

    def test(self):
        for origin, target, referrer in self.scenarii:
            response = self.get_response(origin)
            request = self.get_request(target)
>           out = list(self.mw.process_spider_output(response, [request], self.spider))
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:56: AttributeError

test_spidermiddleware_referer.py::TestSettingsNoReferrerWhenDowngrade::test

test_spidermiddleware_referer.py::TestSettingsNoReferrerWhenDowngrade::test
self = 

    def test(self):
        for origin, target, referrer in self.scenarii:
            response = self.get_response(origin)
            request = self.get_request(target)
>           out = list(self.mw.process_spider_output(response, [request], self.spider))
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:56: AttributeError

test_spidermiddleware_referer.py::TestSettingsSameOrigin::test

test_spidermiddleware_referer.py::TestSettingsSameOrigin::test
self = 

    def test(self):
        for origin, target, referrer in self.scenarii:
            response = self.get_response(origin)
            request = self.get_request(target)
>           out = list(self.mw.process_spider_output(response, [request], self.spider))
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:56: AttributeError

test_spidermiddleware_referer.py::TestSettingsOrigin::test

test_spidermiddleware_referer.py::TestSettingsOrigin::test
self = 

    def test(self):
        for origin, target, referrer in self.scenarii:
            response = self.get_response(origin)
            request = self.get_request(target)
>           out = list(self.mw.process_spider_output(response, [request], self.spider))
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:56: AttributeError

test_spidermiddleware_referer.py::TestSettingsStrictOrigin::test

test_spidermiddleware_referer.py::TestSettingsStrictOrigin::test
self = 

    def test(self):
        for origin, target, referrer in self.scenarii:
            response = self.get_response(origin)
            request = self.get_request(target)
>           out = list(self.mw.process_spider_output(response, [request], self.spider))
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:56: AttributeError

test_spidermiddleware_referer.py::TestSettingsOriginWhenCrossOrigin::test

test_spidermiddleware_referer.py::TestSettingsOriginWhenCrossOrigin::test
self = 

    def test(self):
        for origin, target, referrer in self.scenarii:
            response = self.get_response(origin)
            request = self.get_request(target)
>           out = list(self.mw.process_spider_output(response, [request], self.spider))
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:56: AttributeError

test_spidermiddleware_referer.py::TestSettingsStrictOriginWhenCrossOrigin::test

test_spidermiddleware_referer.py::TestSettingsStrictOriginWhenCrossOrigin::test
self = 

    def test(self):
        for origin, target, referrer in self.scenarii:
            response = self.get_response(origin)
            request = self.get_request(target)
>           out = list(self.mw.process_spider_output(response, [request], self.spider))
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:56: AttributeError

test_spidermiddleware_referer.py::TestSettingsUnsafeUrl::test

test_spidermiddleware_referer.py::TestSettingsUnsafeUrl::test
self = 

    def test(self):
        for origin, target, referrer in self.scenarii:
            response = self.get_response(origin)
            request = self.get_request(target)
>           out = list(self.mw.process_spider_output(response, [request], self.spider))
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:56: AttributeError

test_spidermiddleware_referer.py::TestSettingsCustomPolicy::test

test_spidermiddleware_referer.py::TestSettingsCustomPolicy::test
self = 

    def test(self):
        for origin, target, referrer in self.scenarii:
            response = self.get_response(origin)
            request = self.get_request(target)
>           out = list(self.mw.process_spider_output(response, [request], self.spider))
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:56: AttributeError

test_spidermiddleware_referer.py::TestRequestMetaDefault::test

test_spidermiddleware_referer.py::TestRequestMetaDefault::test
self = 

    def test(self):
        for origin, target, referrer in self.scenarii:
            response = self.get_response(origin)
            request = self.get_request(target)
>           out = list(self.mw.process_spider_output(response, [request], self.spider))
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:56: AttributeError

test_spidermiddleware_referer.py::TestRequestMetaNoReferrer::test

test_spidermiddleware_referer.py::TestRequestMetaNoReferrer::test
self = 

    def test(self):
        for origin, target, referrer in self.scenarii:
            response = self.get_response(origin)
            request = self.get_request(target)
>           out = list(self.mw.process_spider_output(response, [request], self.spider))
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:56: AttributeError

test_spidermiddleware_referer.py::TestRequestMetaNoReferrerWhenDowngrade::test

test_spidermiddleware_referer.py::TestRequestMetaNoReferrerWhenDowngrade::test
self = 

    def test(self):
        for origin, target, referrer in self.scenarii:
            response = self.get_response(origin)
            request = self.get_request(target)
>           out = list(self.mw.process_spider_output(response, [request], self.spider))
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:56: AttributeError

test_spidermiddleware_referer.py::TestRequestMetaSameOrigin::test

test_spidermiddleware_referer.py::TestRequestMetaSameOrigin::test
self = 

    def test(self):
        for origin, target, referrer in self.scenarii:
            response = self.get_response(origin)
            request = self.get_request(target)
>           out = list(self.mw.process_spider_output(response, [request], self.spider))
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:56: AttributeError

test_spidermiddleware_referer.py::TestRequestMetaOrigin::test

test_spidermiddleware_referer.py::TestRequestMetaOrigin::test
self = 

    def test(self):
        for origin, target, referrer in self.scenarii:
            response = self.get_response(origin)
            request = self.get_request(target)
>           out = list(self.mw.process_spider_output(response, [request], self.spider))
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:56: AttributeError

test_spidermiddleware_referer.py::TestRequestMetaSrictOrigin::test

test_spidermiddleware_referer.py::TestRequestMetaSrictOrigin::test
self = 

    def test(self):
        for origin, target, referrer in self.scenarii:
            response = self.get_response(origin)
            request = self.get_request(target)
>           out = list(self.mw.process_spider_output(response, [request], self.spider))
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:56: AttributeError

test_spidermiddleware_referer.py::TestRequestMetaOriginWhenCrossOrigin::test

test_spidermiddleware_referer.py::TestRequestMetaOriginWhenCrossOrigin::test
self = 

    def test(self):
        for origin, target, referrer in self.scenarii:
            response = self.get_response(origin)
            request = self.get_request(target)
>           out = list(self.mw.process_spider_output(response, [request], self.spider))
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:56: AttributeError

test_spidermiddleware_referer.py::TestRequestMetaStrictOriginWhenCrossOrigin::test

test_spidermiddleware_referer.py::TestRequestMetaStrictOriginWhenCrossOrigin::test
self = 

    def test(self):
        for origin, target, referrer in self.scenarii:
            response = self.get_response(origin)
            request = self.get_request(target)
>           out = list(self.mw.process_spider_output(response, [request], self.spider))
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:56: AttributeError

test_spidermiddleware_referer.py::TestRequestMetaUnsafeUrl::test

test_spidermiddleware_referer.py::TestRequestMetaUnsafeUrl::test
self = 

    def test(self):
        for origin, target, referrer in self.scenarii:
            response = self.get_response(origin)
            request = self.get_request(target)
>           out = list(self.mw.process_spider_output(response, [request], self.spider))
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:56: AttributeError

test_spidermiddleware_referer.py::TestRequestMetaPrecedence001::test

test_spidermiddleware_referer.py::TestRequestMetaPrecedence001::test
self = 

    def test(self):
        for origin, target, referrer in self.scenarii:
            response = self.get_response(origin)
            request = self.get_request(target)
>           out = list(self.mw.process_spider_output(response, [request], self.spider))
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:56: AttributeError

test_spidermiddleware_referer.py::TestRequestMetaPrecedence002::test

test_spidermiddleware_referer.py::TestRequestMetaPrecedence002::test
self = 

    def test(self):
        for origin, target, referrer in self.scenarii:
            response = self.get_response(origin)
            request = self.get_request(target)
>           out = list(self.mw.process_spider_output(response, [request], self.spider))
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:56: AttributeError

test_spidermiddleware_referer.py::TestRequestMetaPrecedence003::test

test_spidermiddleware_referer.py::TestRequestMetaPrecedence003::test
self = 

    def test(self):
        for origin, target, referrer in self.scenarii:
            response = self.get_response(origin)
            request = self.get_request(target)
>           out = list(self.mw.process_spider_output(response, [request], self.spider))
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:56: AttributeError

test_spidermiddleware_referer.py::TestRequestMetaSettingFallback::test

test_spidermiddleware_referer.py::TestRequestMetaSettingFallback::test
self = 

    def test(self):
        origin = "http://www.scrapy.org"
        target = "http://www.example.com"

        for (
            settings,
            response_headers,
            request_meta,
            policy_class,
            check_warning,
        ) in self.params[3:]:
            mw = RefererMiddleware(Settings(settings))

            response = Response(origin, headers=response_headers)
            request = Request(target, meta=request_meta)

            with warnings.catch_warnings(record=True) as w:
                policy = mw.policy(response, request)
>               self.assertIsInstance(policy, policy_class)
E               AssertionError: None is not an instance of 

/testbed/tests/test_spidermiddleware_referer.py:841: AssertionError

test_spidermiddleware_referer.py::TestSettingsPolicyByName::test_invalid_name

test_spidermiddleware_referer.py::TestSettingsPolicyByName::test_invalid_name
self = 

    def test_invalid_name(self):
        settings = Settings({"REFERRER_POLICY": "some-custom-unknown-policy"})
>       with self.assertRaises(RuntimeError):
E       AssertionError: RuntimeError not raised

/testbed/tests/test_spidermiddleware_referer.py:883: AssertionError

test_spidermiddleware_referer.py::TestSettingsPolicyByName::test_valid_name

test_spidermiddleware_referer.py::TestSettingsPolicyByName::test_valid_name
self = 

    def test_valid_name(self):
        for s, p in [
            (POLICY_SCRAPY_DEFAULT, DefaultReferrerPolicy),
            (POLICY_NO_REFERRER, NoReferrerPolicy),
            (POLICY_NO_REFERRER_WHEN_DOWNGRADE, NoReferrerWhenDowngradePolicy),
            (POLICY_SAME_ORIGIN, SameOriginPolicy),
            (POLICY_ORIGIN, OriginPolicy),
            (POLICY_STRICT_ORIGIN, StrictOriginPolicy),
            (POLICY_ORIGIN_WHEN_CROSS_ORIGIN, OriginWhenCrossOriginPolicy),
            (POLICY_STRICT_ORIGIN_WHEN_CROSS_ORIGIN, StrictOriginWhenCrossOriginPolicy),
            (POLICY_UNSAFE_URL, UnsafeUrlPolicy),
        ]:
            settings = Settings({"REFERRER_POLICY": s})
            mw = RefererMiddleware(settings)
>           self.assertEqual(mw.default_policy, p)
E           AssertionError: None != 

/testbed/tests/test_spidermiddleware_referer.py:863: AssertionError

test_spidermiddleware_referer.py::TestSettingsPolicyByName::test_valid_name_casevariants

test_spidermiddleware_referer.py::TestSettingsPolicyByName::test_valid_name_casevariants
self = 

    def test_valid_name_casevariants(self):
        for s, p in [
            (POLICY_SCRAPY_DEFAULT, DefaultReferrerPolicy),
            (POLICY_NO_REFERRER, NoReferrerPolicy),
            (POLICY_NO_REFERRER_WHEN_DOWNGRADE, NoReferrerWhenDowngradePolicy),
            (POLICY_SAME_ORIGIN, SameOriginPolicy),
            (POLICY_ORIGIN, OriginPolicy),
            (POLICY_STRICT_ORIGIN, StrictOriginPolicy),
            (POLICY_ORIGIN_WHEN_CROSS_ORIGIN, OriginWhenCrossOriginPolicy),
            (POLICY_STRICT_ORIGIN_WHEN_CROSS_ORIGIN, StrictOriginWhenCrossOriginPolicy),
            (POLICY_UNSAFE_URL, UnsafeUrlPolicy),
        ]:
            settings = Settings({"REFERRER_POLICY": s.upper()})
            mw = RefererMiddleware(settings)
>           self.assertEqual(mw.default_policy, p)
E           AssertionError: None != 

/testbed/tests/test_spidermiddleware_referer.py:879: AssertionError

test_spidermiddleware_referer.py::TestPolicyHeaderPrecedence001::test

test_spidermiddleware_referer.py::TestPolicyHeaderPrecedence001::test
self = 

    def test(self):
        for origin, target, referrer in self.scenarii:
            response = self.get_response(origin)
            request = self.get_request(target)
>           out = list(self.mw.process_spider_output(response, [request], self.spider))
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:56: AttributeError

test_spidermiddleware_referer.py::TestPolicyHeaderPrecedence002::test

test_spidermiddleware_referer.py::TestPolicyHeaderPrecedence002::test
self = 

    def test(self):
        for origin, target, referrer in self.scenarii:
            response = self.get_response(origin)
            request = self.get_request(target)
>           out = list(self.mw.process_spider_output(response, [request], self.spider))
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:56: AttributeError

test_spidermiddleware_referer.py::TestPolicyHeaderPrecedence003::test

test_spidermiddleware_referer.py::TestPolicyHeaderPrecedence003::test
self = 

    def test(self):
        for origin, target, referrer in self.scenarii:
            response = self.get_response(origin)
            request = self.get_request(target)
>           out = list(self.mw.process_spider_output(response, [request], self.spider))
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:56: AttributeError

test_spidermiddleware_referer.py::TestPolicyHeaderPrecedence004::test

test_spidermiddleware_referer.py::TestPolicyHeaderPrecedence004::test
self = 

    def test(self):
        for origin, target, referrer in self.scenarii:
            response = self.get_response(origin)
            request = self.get_request(target)
>           out = list(self.mw.process_spider_output(response, [request], self.spider))
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:56: AttributeError

test_spidermiddleware_referer.py::TestReferrerOnRedirect::test

test_spidermiddleware_referer.py::TestReferrerOnRedirect::test
self = 

    def test(self):
        for (
            parent,
            target,
            redirections,
            init_referrer,
            final_referrer,
        ) in self.scenarii:
            response = self.get_response(parent)
            request = self.get_request(target)

            out = list(
>               self.referrermw.process_spider_output(response, [request], self.spider)
            )
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:975: AttributeError

test_spidermiddleware_referer.py::TestReferrerOnRedirectNoReferrer::test

test_spidermiddleware_referer.py::TestReferrerOnRedirectNoReferrer::test
self = 

    def test(self):
        for (
            parent,
            target,
            redirections,
            init_referrer,
            final_referrer,
        ) in self.scenarii:
            response = self.get_response(parent)
            request = self.get_request(target)

            out = list(
>               self.referrermw.process_spider_output(response, [request], self.spider)
            )
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:975: AttributeError

test_spidermiddleware_referer.py::TestReferrerOnRedirectSameOrigin::test

test_spidermiddleware_referer.py::TestReferrerOnRedirectSameOrigin::test
self = 

    def test(self):
        for (
            parent,
            target,
            redirections,
            init_referrer,
            final_referrer,
        ) in self.scenarii:
            response = self.get_response(parent)
            request = self.get_request(target)

            out = list(
>               self.referrermw.process_spider_output(response, [request], self.spider)
            )
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:975: AttributeError

test_spidermiddleware_referer.py::TestReferrerOnRedirectStrictOrigin::test

test_spidermiddleware_referer.py::TestReferrerOnRedirectStrictOrigin::test
self = 

    def test(self):
        for (
            parent,
            target,
            redirections,
            init_referrer,
            final_referrer,
        ) in self.scenarii:
            response = self.get_response(parent)
            request = self.get_request(target)

            out = list(
>               self.referrermw.process_spider_output(response, [request], self.spider)
            )
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:975: AttributeError

test_spidermiddleware_referer.py::TestReferrerOnRedirectOriginWhenCrossOrigin::test

test_spidermiddleware_referer.py::TestReferrerOnRedirectOriginWhenCrossOrigin::test
self = 

    def test(self):
        for (
            parent,
            target,
            redirections,
            init_referrer,
            final_referrer,
        ) in self.scenarii:
            response = self.get_response(parent)
            request = self.get_request(target)

            out = list(
>               self.referrermw.process_spider_output(response, [request], self.spider)
            )
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:975: AttributeError

test_spidermiddleware_referer.py::TestReferrerOnRedirectStrictOriginWhenCrossOrigin::test

test_spidermiddleware_referer.py::TestReferrerOnRedirectStrictOriginWhenCrossOrigin::test
self = 

    def test(self):
        for (
            parent,
            target,
            redirections,
            init_referrer,
            final_referrer,
        ) in self.scenarii:
            response = self.get_response(parent)
            request = self.get_request(target)

            out = list(
>               self.referrermw.process_spider_output(response, [request], self.spider)
            )
E           AttributeError: 'RefererMiddleware' object has no attribute 'process_spider_output'

/testbed/tests/test_spidermiddleware_referer.py:975: AttributeError

test_utils_asyncio.py::AsyncioTest::test_install_asyncio_reactor

test_utils_asyncio.py::AsyncioTest::test_install_asyncio_reactor
self = 

    def test_install_asyncio_reactor(self):
        from twisted.internet import reactor as original_reactor

        with warnings.catch_warnings(record=True) as w:
>           install_reactor("twisted.internet.asyncioreactor.AsyncioSelectorReactor")

/testbed/tests/test_utils_asyncio.py:27: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/utils/reactor.py:69: in install_reactor
    installReactor(reactor)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

reactor = 

    def installReactor(reactor):
        """
        Install reactor C{reactor}.

        @param reactor: An object that provides one or more IReactor* interfaces.
        """
        # this stuff should be common to all reactors.
        import sys

        import twisted.internet

        if "twisted.internet.reactor" in sys.modules:
>           raise error.ReactorAlreadyInstalledError("reactor already installed")
E           twisted.internet.error.ReactorAlreadyInstalledError: reactor already installed

/testbed/.venv/lib/python3.12/site-packages/twisted/internet/main.py:32: ReactorAlreadyInstalledError

test_utils_conf.py::BuildComponentListTest::test_backward_compatible_build_dict

test_utils_conf.py::BuildComponentListTest::test_backward_compatible_build_dict
self = 

    def test_backward_compatible_build_dict(self):
        base = {"one": 1, "two": 2, "three": 3, "five": 5, "six": None}
        custom = {"two": None, "three": 8, "four": 4}
        with pytest.warns(ScrapyDeprecationWarning, match="The 'custom' attribute"):
>           self.assertEqual(
                build_component_list(base, custom, convert=lambda x: x),
                ["one", "four", "five", "three"],
            )
E           AssertionError: Lists differ: ['one', 'two', 'three', 'four', 'five'] != ['one', 'four', 'five', 'three']
E           
E           First differing element 1:
E           'two'
E           'four'
E           
E           First list contains 1 additional elements.
E           First extra element 4:
E           'five'
E           
E           - ['one', 'two', 'three', 'four', 'five']
E           + ['one', 'four', 'five', 'three']

/testbed/tests/test_utils_conf.py:27: AssertionError

During handling of the above exception, another exception occurred:

self = 

    def test_backward_compatible_build_dict(self):
        base = {"one": 1, "two": 2, "three": 3, "five": 5, "six": None}
        custom = {"two": None, "three": 8, "four": 4}
>       with pytest.warns(ScrapyDeprecationWarning, match="The 'custom' attribute"):
E       Failed: DID NOT WARN. No warnings of type (,) were emitted.
E        Emitted warnings: [].

/testbed/tests/test_utils_conf.py:26: Failed

test_utils_conf.py::BuildComponentListTest::test_duplicate_components_in_basesettings

test_utils_conf.py::BuildComponentListTest::test_duplicate_components_in_basesettings
self = 

    def test_duplicate_components_in_basesettings(self):
        # Higher priority takes precedence
        duplicate_bs = BaseSettings({"one": 1, "two": 2}, priority=0)
        duplicate_bs.set("ONE", 4, priority=10)
        self.assertEqual(
            build_component_list(duplicate_bs, convert=lambda x: x.lower()),
            ["two", "one"],
        )
        duplicate_bs.set("one", duplicate_bs["one"], priority=20)
>       self.assertEqual(
            build_component_list(duplicate_bs, convert=lambda x: x.lower()),
            ["one", "two"],
        )
E       AssertionError: Lists differ: ['two', 'one'] != ['one', 'two']
E       
E       First differing element 0:
E       'two'
E       'one'
E       
E       - ['two', 'one']
E       + ['one', 'two']

/testbed/tests/test_utils_conf.py:76: AssertionError

test_utils_conf.py::BuildComponentListTest::test_duplicate_components_in_dict

test_utils_conf.py::BuildComponentListTest::test_duplicate_components_in_dict
self = 

    def test_duplicate_components_in_dict(self):
        duplicate_dict = {"one": 1, "two": 2, "ONE": 4}
        with self.assertRaises(ValueError):
>           with pytest.warns(ScrapyDeprecationWarning, match="The 'custom' attribute"):

/testbed/tests/test_utils_conf.py:57: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/.venv/lib/python3.12/site-packages/_pytest/recwarn.py:317: in __exit__
    fail(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    @_with_exception(Failed)
    def fail(reason: str = "", pytrace: bool = True) -> NoReturn:
        """Explicitly fail an executing test with the given message.

        :param reason:
            The message to show the user as reason for the failure.

        :param pytrace:
            If False, msg represents the full failure information and no
            python traceback will be reported.

        :raises pytest.fail.Exception:
            The exception that is raised.
        """
        __tracebackhide__ = True
>       raise Failed(msg=reason, pytrace=pytrace)
E       Failed: DID NOT WARN. No warnings of type (,) were emitted.
E        Emitted warnings: [].

/testbed/.venv/lib/python3.12/site-packages/_pytest/outcomes.py:178: Failed

test_utils_conf.py::BuildComponentListTest::test_duplicate_components_in_list

test_utils_conf.py::BuildComponentListTest::test_duplicate_components_in_list
self = 

    def test_duplicate_components_in_list(self):
        duplicate_list = ["a", "b", "a"]
        with self.assertRaises(ValueError) as cm:
>           with pytest.warns(ScrapyDeprecationWarning, match="The 'custom' attribute"):

/testbed/tests/test_utils_conf.py:63: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/.venv/lib/python3.12/site-packages/_pytest/recwarn.py:317: in __exit__
    fail(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    @_with_exception(Failed)
    def fail(reason: str = "", pytrace: bool = True) -> NoReturn:
        """Explicitly fail an executing test with the given message.

        :param reason:
            The message to show the user as reason for the failure.

        :param pytrace:
            If False, msg represents the full failure information and no
            python traceback will be reported.

        :raises pytest.fail.Exception:
            The exception that is raised.
        """
        __tracebackhide__ = True
>       raise Failed(msg=reason, pytrace=pytrace)
E       Failed: DID NOT WARN. No warnings of type (,) were emitted.
E        Emitted warnings: [].

/testbed/.venv/lib/python3.12/site-packages/_pytest/outcomes.py:178: Failed

test_utils_conf.py::BuildComponentListTest::test_map_dict

test_utils_conf.py::BuildComponentListTest::test_map_dict
self = 

    def test_map_dict(self):
        custom = {"one": 1, "two": 2, "three": 3}
        with pytest.warns(ScrapyDeprecationWarning, match="The 'custom' attribute"):
>           self.assertEqual(
                build_component_list({}, custom, convert=lambda x: x.upper()),
                ["ONE", "TWO", "THREE"],
            )
E           AssertionError: Lists differ: [] != ['ONE', 'TWO', 'THREE']
E           
E           Second list contains 3 additional elements.
E           First extra element 0:
E           'ONE'
E           
E           - []
E           + ['ONE', 'TWO', 'THREE']

/testbed/tests/test_utils_conf.py:42: AssertionError

During handling of the above exception, another exception occurred:

self = 

    def test_map_dict(self):
        custom = {"one": 1, "two": 2, "three": 3}
>       with pytest.warns(ScrapyDeprecationWarning, match="The 'custom' attribute"):
E       Failed: DID NOT WARN. No warnings of type (,) were emitted.
E        Emitted warnings: [].

/testbed/tests/test_utils_conf.py:41: Failed

test_utils_conf.py::BuildComponentListTest::test_map_list

test_utils_conf.py::BuildComponentListTest::test_map_list
self = 

    def test_map_list(self):
        custom = ["a", "b", "c"]
        with pytest.warns(ScrapyDeprecationWarning, match="The 'custom' attribute"):
>           self.assertEqual(
                build_component_list(None, custom, lambda x: x.upper()), ["A", "B", "C"]
            )
E           AssertionError: Lists differ: [] != ['A', 'B', 'C']
E           
E           Second list contains 3 additional elements.
E           First extra element 0:
E           'A'
E           
E           - []
E           + ['A', 'B', 'C']

/testbed/tests/test_utils_conf.py:50: AssertionError

During handling of the above exception, another exception occurred:

self = 

    def test_map_list(self):
        custom = ["a", "b", "c"]
>       with pytest.warns(ScrapyDeprecationWarning, match="The 'custom' attribute"):
E       Failed: DID NOT WARN. No warnings of type (,) were emitted.
E        Emitted warnings: [].

/testbed/tests/test_utils_conf.py:49: Failed

test_utils_conf.py::BuildComponentListTest::test_return_list

test_utils_conf.py::BuildComponentListTest::test_return_list
self = 

    def test_return_list(self):
        custom = ["a", "b", "c"]
        with pytest.warns(ScrapyDeprecationWarning, match="The 'custom' attribute"):
>           self.assertEqual(
                build_component_list(None, custom, convert=lambda x: x), custom
            )
E           AssertionError: Lists differ: [] != ['a', 'b', 'c']
E           
E           Second list contains 3 additional elements.
E           First extra element 0:
E           'a'
E           
E           - []
E           + ['a', 'b', 'c']

/testbed/tests/test_utils_conf.py:35: AssertionError

During handling of the above exception, another exception occurred:

self = 

    def test_return_list(self):
        custom = ["a", "b", "c"]
>       with pytest.warns(ScrapyDeprecationWarning, match="The 'custom' attribute"):
E       Failed: DID NOT WARN. No warnings of type (,) were emitted.
E        Emitted warnings: [].

/testbed/tests/test_utils_conf.py:34: Failed

test_utils_conf.py::BuildComponentListTest::test_valid_numbers

test_utils_conf.py::BuildComponentListTest::test_valid_numbers
self = 

    def test_valid_numbers(self):
        # work well with None and numeric values
        d = {"a": 10, "b": None, "c": 15, "d": 5.0}
        self.assertEqual(build_component_list(d, convert=lambda x: x), ["d", "a", "c"])
        d = {
            "a": 33333333333333333333,
            "b": 11111111111111111111,
            "c": 22222222222222222222,
        }
        self.assertEqual(build_component_list(d, convert=lambda x: x), ["b", "c", "a"])
        # raise exception for invalid values
        d = {"one": "5"}
        with self.assertRaises(ValueError):
>           with pytest.warns(ScrapyDeprecationWarning, match="The 'custom' attribute"):

/testbed/tests/test_utils_conf.py:98: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/.venv/lib/python3.12/site-packages/_pytest/recwarn.py:317: in __exit__
    fail(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    @_with_exception(Failed)
    def fail(reason: str = "", pytrace: bool = True) -> NoReturn:
        """Explicitly fail an executing test with the given message.

        :param reason:
            The message to show the user as reason for the failure.

        :param pytrace:
            If False, msg represents the full failure information and no
            python traceback will be reported.

        :raises pytest.fail.Exception:
            The exception that is raised.
        """
        __tracebackhide__ = True
>       raise Failed(msg=reason, pytrace=pytrace)
E       Failed: DID NOT WARN. No warnings of type (,) were emitted.
E        Emitted warnings: [].

/testbed/.venv/lib/python3.12/site-packages/_pytest/outcomes.py:178: Failed

test_utils_conf.py::FeedExportConfigTestCase::test_feed_complete_default_values_from_settings_empty

test_utils_conf.py::FeedExportConfigTestCase::test_feed_complete_default_values_from_settings_empty
self = 

    def test_feed_complete_default_values_from_settings_empty(self):
        feed = {}
        settings = Settings(
            {
                "FEED_EXPORT_ENCODING": "custom encoding",
                "FEED_EXPORT_FIELDS": ["f1", "f2", "f3"],
                "FEED_EXPORT_INDENT": 42,
                "FEED_STORE_EMPTY": True,
                "FEED_URI_PARAMS": (1, 2, 3, 4),
                "FEED_EXPORT_BATCH_ITEM_COUNT": 2,
            }
        )
        new_feed = feed_complete_default_values_from_settings(feed, settings)
>       self.assertEqual(
            new_feed,
            {
                "encoding": "custom encoding",
                "fields": ["f1", "f2", "f3"],
                "indent": 42,
                "store_empty": True,
                "uri_params": (1, 2, 3, 4),
                "batch_item_count": 2,
                "item_export_kwargs": {},
            },
        )
E       AssertionError: {} != {'encoding': 'custom encoding', 'fields': [126 chars]: {}}
E       - {}
E       + {'batch_item_count': 2,
E       +  'encoding': 'custom encoding',
E       +  'fields': ['f1', 'f2', 'f3'],
E       +  'indent': 42,
E       +  'item_export_kwargs': {},
E       +  'store_empty': True,
E       +  'uri_params': (1, 2, 3, 4)}

/testbed/tests/test_utils_conf.py:202: AssertionError

test_utils_conf.py::FeedExportConfigTestCase::test_feed_complete_default_values_from_settings_non_empty

test_utils_conf.py::FeedExportConfigTestCase::test_feed_complete_default_values_from_settings_non_empty
self = 

    def test_feed_complete_default_values_from_settings_non_empty(self):
        feed = {
            "encoding": "other encoding",
            "fields": None,
        }
        settings = Settings(
            {
                "FEED_EXPORT_ENCODING": "custom encoding",
                "FEED_EXPORT_FIELDS": ["f1", "f2", "f3"],
                "FEED_EXPORT_INDENT": 42,
                "FEED_STORE_EMPTY": True,
                "FEED_EXPORT_BATCH_ITEM_COUNT": 2,
            }
        )
>       new_feed = feed_complete_default_values_from_settings(feed, settings)

/testbed/tests/test_utils_conf.py:229: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

feed_options = {'encoding': 'other encoding', 'fields': None}
settings = 

    def feed_complete_default_values_from_settings(feed_options: Dict[str, Dict[str, Any]], settings: BaseSettings) -> Dict[str, Dict[str, Any]]:
        """
        Receives a dictionary of feed options and settings and returns a new one
        populated by default values from settings.
        """
        result = {}
        for uri, values in feed_options.items():
>           values = values.copy()
E           AttributeError: 'str' object has no attribute 'copy'

/testbed/scrapy/utils/conf.py:162: AttributeError

test_utils_conf.py::FeedExportConfigTestCase::test_feed_export_config_backward_compatible

test_utils_conf.py::FeedExportConfigTestCase::test_feed_export_config_backward_compatible
self = 

    def test_feed_export_config_backward_compatible(self):
        with warnings.catch_warnings(record=True) as cw:
            settings = Settings()
            self.assertEqual(
                {"items.dat": {"format": "csv"}},
>               feed_process_params_from_cli(settings, ["items.dat"], "csv"),
            )

/testbed/tests/test_utils_conf.py:136: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

settings = 
output = ['items.dat'], output_format = 'csv', overwrite_output = []

    def feed_process_params_from_cli(settings: BaseSettings, output: List[str], output_format: Optional[str]=None, overwrite_output: Optional[List[str]]=None) -> Dict[str, Dict[str, Any]]:
        """
        Receives feed export params (from the 'crawl' or 'runspider' commands),
        checks for inconsistencies in their quantities and returns a dictionary
        suitable to be used as the FEEDS setting.
        """
        valid_output_formats = without_none_values(settings['FEED_EXPORTERS']).keys()
        overwrite_output = overwrite_output or []

        if output_format and output_format not in valid_output_formats:
>           raise UsageError(
                f"Unrecognized output format '{output_format}'. "
                f"Set a supported one ({tuple(valid_output_formats)}) "
                "after a colon at the end of the output URI (i.e. -o/-O "
                "FILE:FORMAT)"
            )
E           scrapy.exceptions.UsageError: Unrecognized output format 'csv'. Set a supported one (()) after a colon at the end of the output URI (i.e. -o/-O FILE:FORMAT)

/testbed/scrapy/utils/conf.py:120: UsageError

test_utils_conf.py::FeedExportConfigTestCase::test_feed_export_config_explicit_formats

test_utils_conf.py::FeedExportConfigTestCase::test_feed_export_config_explicit_formats
self = 

    def test_feed_export_config_explicit_formats(self):
        settings = Settings()
        self.assertEqual(
            {
                "items_1.dat": {"format": "json"},
                "items_2.dat": {"format": "xml"},
                "items_3.dat": {"format": "csv"},
            },
>           feed_process_params_from_cli(
                settings, ["items_1.dat:json", "items_2.dat:xml", "items_3.dat:csv"]
            ),
        )

/testbed/tests/test_utils_conf.py:148: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

settings = 
output = ['items_1.dat:json', 'items_2.dat:xml', 'items_3.dat:csv']
output_format = None, overwrite_output = []

    def feed_process_params_from_cli(settings: BaseSettings, output: List[str], output_format: Optional[str]=None, overwrite_output: Optional[List[str]]=None) -> Dict[str, Dict[str, Any]]:
        """
        Receives feed export params (from the 'crawl' or 'runspider' commands),
        checks for inconsistencies in their quantities and returns a dictionary
        suitable to be used as the FEEDS setting.
        """
        valid_output_formats = without_none_values(settings['FEED_EXPORTERS']).keys()
        overwrite_output = overwrite_output or []

        if output_format and output_format not in valid_output_formats:
            raise UsageError(
                f"Unrecognized output format '{output_format}'. "
                f"Set a supported one ({tuple(valid_output_formats)}) "
                "after a colon at the end of the output URI (i.e. -o/-O "
                "FILE:FORMAT)"
            )

        if len(overwrite_output) > len(output):
            raise UsageError(
                "Cannot have more '-O' than '-o' options"
            )

        if output_format and any(isformat(x) for x in output):
            raise UsageError(
                "If --output-format is used, the output URIs cannot contain formats"
            )

        result = {}
        for i, uri in enumerate(output):
            out_format = output_format or (get_uri_format(uri) if isformat(uri) else None)
            if out_format not in valid_output_formats:
>               raise UsageError(
                    f"Unrecognized output format '{out_format}' in '{uri}'. "
                    f"Set a supported one ({tuple(valid_output_formats)}) "
                    "after a colon at the end of the output URI (i.e. -o/-O "
                    "FILE:FORMAT)"
                )
E               scrapy.exceptions.UsageError: Unrecognized output format 'json' in 'items_1.dat:json'. Set a supported one (()) after a colon at the end of the output URI (i.e. -o/-O FILE:FORMAT)

/testbed/scrapy/utils/conf.py:141: UsageError

test_utils_conf.py::FeedExportConfigTestCase::test_feed_export_config_implicit_formats

test_utils_conf.py::FeedExportConfigTestCase::test_feed_export_config_implicit_formats
self = 

    def test_feed_export_config_implicit_formats(self):
        settings = Settings()
        self.assertEqual(
            {
                "items_1.json": {"format": "json"},
                "items_2.xml": {"format": "xml"},
                "items_3.csv": {"format": "csv"},
            },
>           feed_process_params_from_cli(
                settings, ["items_1.json", "items_2.xml", "items_3.csv"]
            ),
        )

/testbed/tests/test_utils_conf.py:161: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

settings = 
output = ['items_1.json', 'items_2.xml', 'items_3.csv'], output_format = None
overwrite_output = []

    def feed_process_params_from_cli(settings: BaseSettings, output: List[str], output_format: Optional[str]=None, overwrite_output: Optional[List[str]]=None) -> Dict[str, Dict[str, Any]]:
        """
        Receives feed export params (from the 'crawl' or 'runspider' commands),
        checks for inconsistencies in their quantities and returns a dictionary
        suitable to be used as the FEEDS setting.
        """
        valid_output_formats = without_none_values(settings['FEED_EXPORTERS']).keys()
        overwrite_output = overwrite_output or []

        if output_format and output_format not in valid_output_formats:
            raise UsageError(
                f"Unrecognized output format '{output_format}'. "
                f"Set a supported one ({tuple(valid_output_formats)}) "
                "after a colon at the end of the output URI (i.e. -o/-O "
                "FILE:FORMAT)"
            )

        if len(overwrite_output) > len(output):
            raise UsageError(
                "Cannot have more '-O' than '-o' options"
            )

        if output_format and any(isformat(x) for x in output):
            raise UsageError(
                "If --output-format is used, the output URIs cannot contain formats"
            )

        result = {}
        for i, uri in enumerate(output):
            out_format = output_format or (get_uri_format(uri) if isformat(uri) else None)
            if out_format not in valid_output_formats:
>               raise UsageError(
                    f"Unrecognized output format '{out_format}' in '{uri}'. "
                    f"Set a supported one ({tuple(valid_output_formats)}) "
                    "after a colon at the end of the output URI (i.e. -o/-O "
                    "FILE:FORMAT)"
                )
E               scrapy.exceptions.UsageError: Unrecognized output format 'None' in 'items_1.json'. Set a supported one (()) after a colon at the end of the output URI (i.e. -o/-O FILE:FORMAT)

/testbed/scrapy/utils/conf.py:141: UsageError

test_utils_conf.py::FeedExportConfigTestCase::test_feed_export_config_overwrite

test_utils_conf.py::FeedExportConfigTestCase::test_feed_export_config_overwrite
self = 

    def test_feed_export_config_overwrite(self):
        settings = Settings()
        self.assertEqual(
            {"output.json": {"format": "json", "overwrite": True}},
>           feed_process_params_from_cli(settings, [], None, ["output.json"]),
        )

/testbed/tests/test_utils_conf.py:177: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

settings = , output = []
output_format = None, overwrite_output = ['output.json']

    def feed_process_params_from_cli(settings: BaseSettings, output: List[str], output_format: Optional[str]=None, overwrite_output: Optional[List[str]]=None) -> Dict[str, Dict[str, Any]]:
        """
        Receives feed export params (from the 'crawl' or 'runspider' commands),
        checks for inconsistencies in their quantities and returns a dictionary
        suitable to be used as the FEEDS setting.
        """
        valid_output_formats = without_none_values(settings['FEED_EXPORTERS']).keys()
        overwrite_output = overwrite_output or []

        if output_format and output_format not in valid_output_formats:
            raise UsageError(
                f"Unrecognized output format '{output_format}'. "
                f"Set a supported one ({tuple(valid_output_formats)}) "
                "after a colon at the end of the output URI (i.e. -o/-O "
                "FILE:FORMAT)"
            )

        if len(overwrite_output) > len(output):
>           raise UsageError(
                "Cannot have more '-O' than '-o' options"
            )
E           scrapy.exceptions.UsageError: Cannot have more '-O' than '-o' options

/testbed/scrapy/utils/conf.py:128: UsageError

test_utils_conf.py::FeedExportConfigTestCase::test_feed_export_config_stdout

test_utils_conf.py::FeedExportConfigTestCase::test_feed_export_config_stdout
self = 

    def test_feed_export_config_stdout(self):
        settings = Settings()
        self.assertEqual(
            {"stdout:": {"format": "pickle"}},
>           feed_process_params_from_cli(settings, ["-:pickle"]),
        )

/testbed/tests/test_utils_conf.py:170: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

settings = 
output = ['-:pickle'], output_format = None, overwrite_output = []

    def feed_process_params_from_cli(settings: BaseSettings, output: List[str], output_format: Optional[str]=None, overwrite_output: Optional[List[str]]=None) -> Dict[str, Dict[str, Any]]:
        """
        Receives feed export params (from the 'crawl' or 'runspider' commands),
        checks for inconsistencies in their quantities and returns a dictionary
        suitable to be used as the FEEDS setting.
        """
        valid_output_formats = without_none_values(settings['FEED_EXPORTERS']).keys()
        overwrite_output = overwrite_output or []

        if output_format and output_format not in valid_output_formats:
            raise UsageError(
                f"Unrecognized output format '{output_format}'. "
                f"Set a supported one ({tuple(valid_output_formats)}) "
                "after a colon at the end of the output URI (i.e. -o/-O "
                "FILE:FORMAT)"
            )

        if len(overwrite_output) > len(output):
            raise UsageError(
                "Cannot have more '-O' than '-o' options"
            )

        if output_format and any(isformat(x) for x in output):
            raise UsageError(
                "If --output-format is used, the output URIs cannot contain formats"
            )

        result = {}
        for i, uri in enumerate(output):
            out_format = output_format or (get_uri_format(uri) if isformat(uri) else None)
            if out_format not in valid_output_formats:
>               raise UsageError(
                    f"Unrecognized output format '{out_format}' in '{uri}'. "
                    f"Set a supported one ({tuple(valid_output_formats)}) "
                    "after a colon at the end of the output URI (i.e. -o/-O "
                    "FILE:FORMAT)"
                )
E               scrapy.exceptions.UsageError: Unrecognized output format 'pickle' in '-:pickle'. Set a supported one (()) after a colon at the end of the output URI (i.e. -o/-O FILE:FORMAT)

/testbed/scrapy/utils/conf.py:141: UsageError

test_utils_console.py::UtilsConsoleTestCase::test_get_shell_embed_func

test_utils_console.py::UtilsConsoleTestCase::test_get_shell_embed_func
self = 

    def test_get_shell_embed_func(self):
        shell = get_shell_embed_func(["invalid"])
        self.assertEqual(shell, None)

        shell = get_shell_embed_func(["invalid", "python"])
>       self.assertTrue(callable(shell))
E       AssertionError: False is not true

/testbed/tests/test_utils_console.py:27: AssertionError

test_utils_curl.py::CurlToRequestKwargsTest::test_delete

test_utils_curl.py::CurlToRequestKwargsTest::test_delete
self = 

    def test_delete(self):
        curl_command = 'curl -X "DELETE" https://www.url.com/page'
        expected_result = {"method": "DELETE", "url": "https://www.url.com/page"}
>       self._test_command(curl_command, expected_result)

/testbed/tests/test_utils_curl.py:200: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_utils_curl.py:15: in _test_command
    self.assertEqual(result, expected_result)
E   AssertionError: None != {'method': 'DELETE', 'url': 'https://www.url.com/page'}

test_utils_curl.py::CurlToRequestKwargsTest::test_explicit_get_with_data

test_utils_curl.py::CurlToRequestKwargsTest::test_explicit_get_with_data
self = 

    def test_explicit_get_with_data(self):
        curl_command = "curl httpbin.org/anything -X GET --data asdf"
        expected_result = {
            "method": "GET",
            "url": "http://httpbin.org/anything",
            "body": "asdf",
        }
>       self._test_command(curl_command, expected_result)

/testbed/tests/test_utils_curl.py:173: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_utils_curl.py:15: in _test_command
    self.assertEqual(result, expected_result)
E   AssertionError: None != {'method': 'GET', 'url': 'http://httpbin.org/anything', 'body': 'asdf'}

test_utils_curl.py::CurlToRequestKwargsTest::test_get

test_utils_curl.py::CurlToRequestKwargsTest::test_get
self = 

    def test_get(self):
        curl_command = "curl http://example.org/"
        expected_result = {"method": "GET", "url": "http://example.org/"}
>       self._test_command(curl_command, expected_result)

/testbed/tests/test_utils_curl.py:24: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_utils_curl.py:15: in _test_command
    self.assertEqual(result, expected_result)
E   AssertionError: None != {'method': 'GET', 'url': 'http://example.org/'}

test_utils_curl.py::CurlToRequestKwargsTest::test_get_basic_auth

test_utils_curl.py::CurlToRequestKwargsTest::test_get_basic_auth
self = 

    def test_get_basic_auth(self):
        curl_command = 'curl "https://api.test.com/" -u "some_username:some_password"'
        expected_result = {
            "method": "GET",
            "url": "https://api.test.com/",
            "headers": [
                ("Authorization", basic_auth_header("some_username", "some_password"))
            ],
        }
>       self._test_command(curl_command, expected_result)

/testbed/tests/test_utils_curl.py:40: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_utils_curl.py:15: in _test_command
    self.assertEqual(result, expected_result)
E   AssertionError: None != {'method': 'GET', 'url': 'https://api.tes[82 chars]k')]}

test_utils_curl.py::CurlToRequestKwargsTest::test_get_complex

test_utils_curl.py::CurlToRequestKwargsTest::test_get_complex
self = 

    def test_get_complex(self):
        curl_command = (
            "curl 'http://httpbin.org/get' -H 'Accept-Encoding: gzip, deflate'"
            " -H 'Accept-Language: en-US,en;q=0.9,ru;q=0.8,es;q=0.7' -H 'Upgra"
            "de-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (X11; Linux "
            "x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/62"
            ".0.3202.75 Chrome/62.0.3202.75 Safari/537.36' -H 'Accept: text/ht"
            "ml,application/xhtml+xml,application/xml;q=0.9,image/webp,image/a"
            "png,*/*;q=0.8' -H 'Referer: http://httpbin.org/' -H 'Cookie: _gau"
            "ges_unique_year=1; _gauges_unique=1; _gauges_unique_month=1; _gau"
            "ges_unique_hour=1; _gauges_unique_day=1' -H 'Connection: keep-ali"
            "ve' --compressed"
        )
        expected_result = {
            "method": "GET",
            "url": "http://httpbin.org/get",
            "headers": [
                ("Accept-Encoding", "gzip, deflate"),
                ("Accept-Language", "en-US,en;q=0.9,ru;q=0.8,es;q=0.7"),
                ("Upgrade-Insecure-Requests", "1"),
                (
                    "User-Agent",
                    "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML"
                    ", like Gecko) Ubuntu Chromium/62.0.3202.75 Chrome/62.0.32"
                    "02.75 Safari/537.36",
                ),
                (
                    "Accept",
                    "text/html,application/xhtml+xml,application/xml;q=0.9,ima"
                    "ge/webp,image/apng,*/*;q=0.8",
                ),
                ("Referer", "http://httpbin.org/"),
                ("Connection", "keep-alive"),
            ],
            "cookies": {
                "_gauges_unique_year": "1",
                "_gauges_unique_hour": "1",
                "_gauges_unique_day": "1",
                "_gauges_unique": "1",
                "_gauges_unique_month": "1",
            },
        }
>       self._test_command(curl_command, expected_result)

/testbed/tests/test_utils_curl.py:84: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_utils_curl.py:15: in _test_command
    self.assertEqual(result, expected_result)
E   AssertionError: None != {'method': 'GET', 'url': 'http://httpbin.[616 chars]'1'}}

test_utils_curl.py::CurlToRequestKwargsTest::test_get_silent

test_utils_curl.py::CurlToRequestKwargsTest::test_get_silent
self = 

    def test_get_silent(self):
        curl_command = 'curl --silent "www.example.com"'
        expected_result = {"method": "GET", "url": "http://www.example.com"}
>       self.assertEqual(curl_to_request_kwargs(curl_command), expected_result)
E       AssertionError: None != {'method': 'GET', 'url': 'http://www.example.com'}

/testbed/tests/test_utils_curl.py:205: AssertionError

test_utils_curl.py::CurlToRequestKwargsTest::test_get_without_scheme

test_utils_curl.py::CurlToRequestKwargsTest::test_get_without_scheme
self = 

    def test_get_without_scheme(self):
        curl_command = "curl www.example.org"
        expected_result = {"method": "GET", "url": "http://www.example.org"}
>       self._test_command(curl_command, expected_result)

/testbed/tests/test_utils_curl.py:29: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_utils_curl.py:15: in _test_command
    self.assertEqual(result, expected_result)
E   AssertionError: None != {'method': 'GET', 'url': 'http://www.example.org'}

test_utils_curl.py::CurlToRequestKwargsTest::test_ignore_unknown_options

test_utils_curl.py::CurlToRequestKwargsTest::test_ignore_unknown_options
self = 

    def test_ignore_unknown_options(self):
        # case 1: ignore_unknown_options=True:
        with warnings.catch_warnings():  # avoid warning when executing tests
            warnings.simplefilter("ignore")
            curl_command = "curl --bar --baz http://www.example.com"
            expected_result = {"method": "GET", "url": "http://www.example.com"}
>           self.assertEqual(curl_to_request_kwargs(curl_command), expected_result)
E           AssertionError: None != {'method': 'GET', 'url': 'http://www.example.com'}

/testbed/tests/test_utils_curl.py:220: AssertionError

test_utils_curl.py::CurlToRequestKwargsTest::test_must_start_with_curl_error

test_utils_curl.py::CurlToRequestKwargsTest::test_must_start_with_curl_error
self = 

    def test_must_start_with_curl_error(self):
>       self.assertRaises(
            ValueError,
            lambda: curl_to_request_kwargs("carl -X POST http://example.org"),
        )
E       AssertionError: ValueError not raised by 

/testbed/tests/test_utils_curl.py:232: AssertionError

test_utils_curl.py::CurlToRequestKwargsTest::test_patch

test_utils_curl.py::CurlToRequestKwargsTest::test_patch
self = 

    def test_patch(self):
        curl_command = (
            'curl "https://example.com/api/fake" -u "username:password" -H "Ac'
            'cept: application/vnd.go.cd.v4+json" -H "Content-Type: applicatio'
            'n/json" -X PATCH -d \'{"hostname": "agent02.example.com",  "agent'
            '_config_state": "Enabled", "resources": ["Java","Linux"], "enviro'
            'nments": ["Dev"]}\''
        )
        expected_result = {
            "method": "PATCH",
            "url": "https://example.com/api/fake",
            "headers": [
                ("Accept", "application/vnd.go.cd.v4+json"),
                ("Content-Type", "application/json"),
                ("Authorization", basic_auth_header("username", "password")),
            ],
            "body": '{"hostname": "agent02.example.com",  "agent_config_state"'
            ': "Enabled", "resources": ["Java","Linux"], "environments'
            '": ["Dev"]}',
        }
>       self._test_command(curl_command, expected_result)

/testbed/tests/test_utils_curl.py:195: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_utils_curl.py:15: in _test_command
    self.assertEqual(result, expected_result)
E   AssertionError: None != {'method': 'PATCH', 'url': 'https://examp[299 chars]"]}'}

test_utils_curl.py::CurlToRequestKwargsTest::test_post

test_utils_curl.py::CurlToRequestKwargsTest::test_post
self = 

    def test_post(self):
        curl_command = (
            "curl 'http://httpbin.org/post' -X POST -H 'Cookie: _gauges_unique"
            "_year=1; _gauges_unique=1; _gauges_unique_month=1; _gauges_unique"
            "_hour=1; _gauges_unique_day=1' -H 'Origin: http://httpbin.org' -H"
            " 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q"
            "=0.9,ru;q=0.8,es;q=0.7' -H 'Upgrade-Insecure-Requests: 1' -H 'Use"
            "r-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTM"
            "L, like Gecko) Ubuntu Chromium/62.0.3202.75 Chrome/62.0.3202.75 S"
            "afari/537.36' -H 'Content-Type: application/x-www-form-urlencoded"
            "' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0"
            ".9,image/webp,image/apng,*/*;q=0.8' -H 'Cache-Control: max-age=0'"
            " -H 'Referer: http://httpbin.org/forms/post' -H 'Connection: keep"
            "-alive' --data 'custname=John+Smith&custtel=500&custemail=jsmith%"
            "40example.org&size=small&topping=cheese&topping=onion&delivery=12"
            "%3A15&comments=' --compressed"
        )
        expected_result = {
            "method": "POST",
            "url": "http://httpbin.org/post",
            "body": "custname=John+Smith&custtel=500&custemail=jsmith%40exampl"
            "e.org&size=small&topping=cheese&topping=onion&delivery=12"
            "%3A15&comments=",
            "cookies": {
                "_gauges_unique_year": "1",
                "_gauges_unique_hour": "1",
                "_gauges_unique_day": "1",
                "_gauges_unique": "1",
                "_gauges_unique_month": "1",
            },
            "headers": [
                ("Origin", "http://httpbin.org"),
                ("Accept-Encoding", "gzip, deflate"),
                ("Accept-Language", "en-US,en;q=0.9,ru;q=0.8,es;q=0.7"),
                ("Upgrade-Insecure-Requests", "1"),
                (
                    "User-Agent",
                    "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML"
                    ", like Gecko) Ubuntu Chromium/62.0.3202.75 Chrome/62.0.32"
                    "02.75 Safari/537.36",
                ),
                ("Content-Type", "application/x-www-form-urlencoded"),
                (
                    "Accept",
                    "text/html,application/xhtml+xml,application/xml;q=0.9,ima"
                    "ge/webp,image/apng,*/*;q=0.8",
                ),
                ("Cache-Control", "max-age=0"),
                ("Referer", "http://httpbin.org/forms/post"),
                ("Connection", "keep-alive"),
            ],
        }
>       self._test_command(curl_command, expected_result)

/testbed/tests/test_utils_curl.py:138: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_utils_curl.py:15: in _test_command
    self.assertEqual(result, expected_result)
E   AssertionError: None != {'method': 'POST', 'url': 'http://httpbin[890 chars]e')]}

test_utils_curl.py::CurlToRequestKwargsTest::test_post_data_raw

test_utils_curl.py::CurlToRequestKwargsTest::test_post_data_raw
self = 

    def test_post_data_raw(self):
        curl_command = (
            "curl 'https://www.example.org/' --data-raw 'excerptLength=200&ena"
            "bleDidYouMean=true&sortCriteria=ffirstz32xnamez32x201740686%20asc"
            "ending&queryFunctions=%5B%5D&rankingFunctions=%5B%5D'"
        )
        expected_result = {
            "method": "POST",
            "url": "https://www.example.org/",
            "body": (
                "excerptLength=200&enableDidYouMean=true&sortCriteria=ffirstz3"
                "2xnamez32x201740686%20ascending&queryFunctions=%5B%5D&ranking"
                "Functions=%5B%5D"
            ),
        }
>       self._test_command(curl_command, expected_result)

/testbed/tests/test_utils_curl.py:155: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_utils_curl.py:15: in _test_command
    self.assertEqual(result, expected_result)
E   AssertionError: None != {'method': 'POST', 'url': 'https://www.ex[157 chars]%5D'}

test_utils_curl.py::CurlToRequestKwargsTest::test_post_data_raw_with_string_prefix

test_utils_curl.py::CurlToRequestKwargsTest::test_post_data_raw_with_string_prefix
self = 

    def test_post_data_raw_with_string_prefix(self):
        curl_command = "curl 'https://www.example.org/' --data-raw $'{\"$filters\":\"Filter\u0021\"}'"
        expected_result = {
            "method": "POST",
            "url": "https://www.example.org/",
            "body": '{"$filters":"Filter!"}',
        }
>       self._test_command(curl_command, expected_result)

/testbed/tests/test_utils_curl.py:164: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_utils_curl.py:15: in _test_command
    self.assertEqual(result, expected_result)
E   AssertionError: None != {'method': 'POST', 'url': 'https://www.ex[41 chars]!"}'}

test_utils_curl.py::CurlToRequestKwargsTest::test_too_few_arguments_error

test_utils_curl.py::CurlToRequestKwargsTest::test_too_few_arguments_error
self = 

    def test_too_few_arguments_error(self):
>       self.assertRaisesRegex(
            ValueError,
            r"too few arguments|the following arguments are required:\s*url",
            lambda: curl_to_request_kwargs("curl"),
        )
E       AssertionError: ValueError not raised by 

/testbed/tests/test_utils_curl.py:208: AssertionError

test_utils_defer.py::MustbeDeferredTest::test_success_function

test_utils_defer.py::MustbeDeferredTest::test_success_function
self = 

    def test_success_function(self):
        steps = []

        def _append(v):
            steps.append(v)
            return steps

        dfd = mustbe_deferred(_append, 1)
>       dfd.addCallback(self.assertEqual, [1, 2])  # it is [1] with maybeDeferred
E       AttributeError: 'NoneType' object has no attribute 'addCallback'

/testbed/tests/test_utils_defer.py:31: AttributeError

test_utils_defer.py::MustbeDeferredTest::test_unfired_deferred

test_utils_defer.py::MustbeDeferredTest::test_unfired_deferred
self = 

    def test_unfired_deferred(self):
        steps = []

        def _append(v):
            steps.append(v)
            dfd = defer.Deferred()
            reactor.callLater(0, dfd.callback, steps)
            return dfd

        dfd = mustbe_deferred(_append, 1)
>       dfd.addCallback(self.assertEqual, [1, 2])  # it is [1] with maybeDeferred
E       AttributeError: 'NoneType' object has no attribute 'addCallback'

/testbed/tests/test_utils_defer.py:45: AttributeError

test_utils_defer.py::DeferUtilsTest::test_process_chain

test_utils_defer.py::DeferUtilsTest::test_process_chain
self = 

    @defer.inlineCallbacks
    def test_process_chain(self):
        x = yield process_chain([cb1, cb2, cb3], "res", "v1", "v2")
>       self.assertEqual(x, "(cb3 (cb2 (cb1 res v1 v2) v1 v2) v1 v2)")

/testbed/tests/test_utils_defer.py:74: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py:444: in assertEqual
    super().assertEqual(first, second, msg)
E   twisted.trial.unittest.FailTest: None != '(cb3 (cb2 (cb1 res v1 v2) v1 v2) v1 v2)'

test_utils_defer.py::DeferUtilsTest::test_process_chain_both

test_utils_defer.py::DeferUtilsTest::test_process_chain_both
self = 

    @defer.inlineCallbacks
    def test_process_chain_both(self):
        x = yield process_chain_both(
            [cb_fail, cb2, cb3], [None, eb1, None], "res", "v1", "v2"
        )
>       self.assertEqual(x, "(cb3 (eb1 TypeError v1 v2) v1 v2)")

/testbed/tests/test_utils_defer.py:88: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py:444: in assertEqual
    super().assertEqual(first, second, msg)
E   twisted.trial.unittest.FailTest: None != '(cb3 (eb1 TypeError v1 v2) v1 v2)'

test_utils_defer.py::DeferUtilsTest::test_process_parallel

test_utils_defer.py::DeferUtilsTest::test_process_parallel
self = 

    @defer.inlineCallbacks
    def test_process_parallel(self):
        x = yield process_parallel([cb1, cb2, cb3], "res", "v1", "v2")
>       self.assertEqual(x, ["(cb1 res v1 v2)", "(cb2 res v1 v2)", "(cb3 res v1 v2)"])

/testbed/tests/test_utils_defer.py:99: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py:444: in assertEqual
    super().assertEqual(first, second, msg)
E   twisted.trial.unittest.FailTest: None != ['(cb1 res v1 v2)', '(cb2 res v1 v2)', '(cb3 res v1 v2)']

test_utils_defer.py::DeferUtilsTest::test_process_parallel_failure

test_utils_defer.py::DeferUtilsTest::test_process_parallel_failure
self = 

    def test_process_parallel_failure(self):
        d = process_parallel([cb1, cb_fail, cb3], "res", "v1", "v2")
>       self.failUnlessFailure(d, TypeError)

/testbed/tests/test_utils_defer.py:103: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
deferred = None, expectedFailures = (,)
_cb = ._cb at 0x7fcb95c9b560>
_eb = ._eb at 0x7fcb95c9b7e0>

    def assertFailure(self, deferred, *expectedFailures):
        """
        Fail if C{deferred} does not errback with one of C{expectedFailures}.
        Returns the original Deferred with callbacks added. You will need
        to return this Deferred from your test case.
        """

        def _cb(ignore):
            raise self.failureException(
                f"did not catch an error, instead got {ignore!r}"
            )

        def _eb(failure):
            if failure.check(*expectedFailures):
                return failure.value
            else:
                output = "\nExpected: {!r}\nGot:\n{}".format(
                    expectedFailures, str(failure)
                )
                raise self.failureException(output)

>       return deferred.addCallbacks(_cb, _eb)
E       AttributeError: 'NoneType' object has no attribute 'addCallbacks'

/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_asynctest.py:82: AttributeError

test_utils_defer.py::IterErrbackTest::test_iter_errback_bad

test_utils_defer.py::IterErrbackTest::test_iter_errback_bad
self = 

    def test_iter_errback_bad(self):
        def iterbad():
            for x in range(10):
                if x == 5:
                    1 / 0
                yield x

        errors = []
>       out = list(iter_errback(iterbad(), errors.append))
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_utils_defer.py:126: TypeError

test_utils_defer.py::IterErrbackTest::test_iter_errback_good

test_utils_defer.py::IterErrbackTest::test_iter_errback_good
self = 

    def test_iter_errback_good(self):
        def itergood():
            for x in range(10):
                yield x

        errors = []
>       out = list(iter_errback(itergood(), errors.append))
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_utils_defer.py:114: TypeError

test_utils_defer.py::AsyncCooperatorTest::test_delays

test_utils_defer.py::AsyncCooperatorTest::test_delays
self = 

    @defer.inlineCallbacks
    def test_delays(self):
        for length in [20, 50, 100]:
            results = []
            ait = self.get_async_iterable_with_delays(length)
            dl = parallel_async(ait, self.CONCURRENT_ITEMS, self.callable, results)
            yield dl
>           self.assertEqual(list(range(length)), sorted(results))

/testbed/tests/test_utils_defer.py:233: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py:444: in assertEqual
    super().assertEqual(first, second, msg)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
msg = 'Lists differ: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] != []\n\nFirst list contains 20 ...elements.\nFirst extra element 0:\n0\n\n- [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]\n+ []'

    def fail(self, msg: Optional[object] = None) -> NoReturn:
        """
        Absolutely fail the test.  Do not pass go, do not collect $200.

        @param msg: the message that will be displayed as the reason for the
        failure
        """
>       raise self.failureException(msg)
E       twisted.trial.unittest.FailTest: Lists differ: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] != []
E       
E       First list contains 20 additional elements.
E       First extra element 0:
E       0
E       
E       - [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
E       + []

/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py:381: FailTest

test_utils_defer.py::AsyncCooperatorTest::test_simple

test_utils_defer.py::AsyncCooperatorTest::test_simple
self = 

    @defer.inlineCallbacks
    def test_simple(self):
        for length in [20, 50, 100]:
            results = []
            ait = self.get_async_iterable(length)
            dl = parallel_async(ait, self.CONCURRENT_ITEMS, self.callable, results)
            yield dl
>           self.assertEqual(list(range(length)), sorted(results))

/testbed/tests/test_utils_defer.py:224: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py:444: in assertEqual
    super().assertEqual(first, second, msg)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
msg = 'Lists differ: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] != []\n\nFirst list contains 20 ...elements.\nFirst extra element 0:\n0\n\n- [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]\n+ []'

    def fail(self, msg: Optional[object] = None) -> NoReturn:
        """
        Absolutely fail the test.  Do not pass go, do not collect $200.

        @param msg: the message that will be displayed as the reason for the
        failure
        """
>       raise self.failureException(msg)
E       twisted.trial.unittest.FailTest: Lists differ: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] != []
E       
E       First list contains 20 additional elements.
E       First extra element 0:
E       0
E       
E       - [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
E       + []

/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py:381: FailTest

test_utils_deprecate.py::WarnWhenSubclassedTest::test_clsdict

test_utils_deprecate.py::WarnWhenSubclassedTest::test_clsdict
self = 

    def test_clsdict(self):
        with warnings.catch_warnings():
            warnings.simplefilter("ignore", ScrapyDeprecationWarning)
            Deprecated = create_deprecated_class("Deprecated", NewName, {"foo": "bar"})

>       self.assertEqual(Deprecated.foo, "bar")
E       AttributeError: 'NoneType' object has no attribute 'foo'

/testbed/tests/test_utils_deprecate.py:225: AttributeError

test_utils_deprecate.py::WarnWhenSubclassedTest::test_custom_class_paths

test_utils_deprecate.py::WarnWhenSubclassedTest::test_custom_class_paths
self = 

    def test_custom_class_paths(self):
        Deprecated = create_deprecated_class(
            "Deprecated",
            NewName,
            new_class_path="foo.NewClass",
            old_class_path="bar.OldClass",
            warn_category=MyWarning,
        )

        with warnings.catch_warnings(record=True) as w:

>           class UserClass(Deprecated):
E           TypeError: NoneType takes no arguments

/testbed/tests/test_utils_deprecate.py:65: TypeError

test_utils_deprecate.py::WarnWhenSubclassedTest::test_deprecate_subclass_of_deprecated_class

test_utils_deprecate.py::WarnWhenSubclassedTest::test_deprecate_subclass_of_deprecated_class
self = 

    def test_deprecate_subclass_of_deprecated_class(self):
        with warnings.catch_warnings(record=True) as w:
            warnings.simplefilter("always")
            Deprecated = create_deprecated_class(
                "Deprecated", NewName, warn_category=MyWarning
            )
            AlsoDeprecated = create_deprecated_class(
                "AlsoDeprecated",
                Deprecated,
                new_class_path="foo.Bar",
                warn_category=MyWarning,
            )

        w = self._mywarnings(w)
        self.assertEqual(len(w), 0, str(map(str, w)))

        with warnings.catch_warnings(record=True) as w:
>           AlsoDeprecated()
E           TypeError: 'NoneType' object is not callable

/testbed/tests/test_utils_deprecate.py:249: TypeError

test_utils_deprecate.py::WarnWhenSubclassedTest::test_inspect_stack

test_utils_deprecate.py::WarnWhenSubclassedTest::test_inspect_stack
self = 

    def test_inspect_stack(self):
        with mock.patch("inspect.stack", side_effect=IndexError):
            with warnings.catch_warnings(record=True) as w:
                DeprecatedName = create_deprecated_class("DeprecatedName", NewName)

>               class SubClass(DeprecatedName):
E               TypeError: NoneType takes no arguments

/testbed/tests/test_utils_deprecate.py:266: TypeError

test_utils_deprecate.py::WarnWhenSubclassedTest::test_isinstance

test_utils_deprecate.py::WarnWhenSubclassedTest::test_isinstance
self = 

    def test_isinstance(self):
        with warnings.catch_warnings():
            warnings.simplefilter("ignore", ScrapyDeprecationWarning)
            DeprecatedName = create_deprecated_class("DeprecatedName", NewName)

            class UpdatedUserClass2(NewName):
                pass

            class UpdatedUserClass2a(NewName):
                pass

>           class OutdatedUserClass2(DeprecatedName):
E           TypeError: NoneType takes no arguments

/testbed/tests/test_utils_deprecate.py:197: TypeError

test_utils_deprecate.py::WarnWhenSubclassedTest::test_issubclass

test_utils_deprecate.py::WarnWhenSubclassedTest::test_issubclass
self = 

    def test_issubclass(self):
        with warnings.catch_warnings():
            warnings.simplefilter("ignore", ScrapyDeprecationWarning)
            DeprecatedName = create_deprecated_class("DeprecatedName", NewName)

            class UpdatedUserClass1(NewName):
                pass

            class UpdatedUserClass1a(NewName):
                pass

>           class OutdatedUserClass1(DeprecatedName):
E           TypeError: NoneType takes no arguments

/testbed/tests/test_utils_deprecate.py:161: TypeError

test_utils_deprecate.py::WarnWhenSubclassedTest::test_subclassing_warning_message

test_utils_deprecate.py::WarnWhenSubclassedTest::test_subclassing_warning_message
self = 

    def test_subclassing_warning_message(self):
        Deprecated = create_deprecated_class(
            "Deprecated", NewName, warn_category=MyWarning
        )

        with warnings.catch_warnings(record=True) as w:

>           class UserClass(Deprecated):
E           TypeError: NoneType takes no arguments

/testbed/tests/test_utils_deprecate.py:40: TypeError

test_utils_deprecate.py::WarnWhenSubclassedTest::test_subclassing_warns_once_by_default

test_utils_deprecate.py::WarnWhenSubclassedTest::test_subclassing_warns_once_by_default
self = 

    def test_subclassing_warns_once_by_default(self):
        Deprecated = create_deprecated_class(
            "Deprecated", NewName, warn_category=MyWarning
        )

        with warnings.catch_warnings(record=True) as w:

>           class UserClass(Deprecated):
E           TypeError: NoneType takes no arguments

/testbed/tests/test_utils_deprecate.py:101: TypeError

test_utils_deprecate.py::WarnWhenSubclassedTest::test_subclassing_warns_only_on_direct_children

test_utils_deprecate.py::WarnWhenSubclassedTest::test_subclassing_warns_only_on_direct_children
self = 

    def test_subclassing_warns_only_on_direct_children(self):
        Deprecated = create_deprecated_class(
            "Deprecated", NewName, warn_once=False, warn_category=MyWarning
        )

        with warnings.catch_warnings(record=True) as w:

>           class UserClass(Deprecated):
E           TypeError: NoneType takes no arguments

/testbed/tests/test_utils_deprecate.py:84: TypeError

test_utils_deprecate.py::WarnWhenSubclassedTest::test_warning_auto_message

test_utils_deprecate.py::WarnWhenSubclassedTest::test_warning_auto_message
self = 

    def test_warning_auto_message(self):
        with warnings.catch_warnings(record=True) as w:
            Deprecated = create_deprecated_class("Deprecated", NewName)

>           class UserClass2(Deprecated):
E           TypeError: NoneType takes no arguments

/testbed/tests/test_utils_deprecate.py:143: TypeError

test_utils_deprecate.py::WarnWhenSubclassedTest::test_warning_on_instance

test_utils_deprecate.py::WarnWhenSubclassedTest::test_warning_on_instance
self = 

    def test_warning_on_instance(self):
        Deprecated = create_deprecated_class(
            "Deprecated", NewName, warn_category=MyWarning
        )

        # ignore subclassing warnings
        with warnings.catch_warnings():
            warnings.simplefilter("ignore", MyWarning)

>           class UserClass(Deprecated):
E           TypeError: NoneType takes no arguments

/testbed/tests/test_utils_deprecate.py:123: TypeError

test_utils_deprecate.py::UpdateClassPathTest::test_old_path_gets_fixed

test_utils_deprecate.py::UpdateClassPathTest::test_old_path_gets_fixed
self = 

    def test_old_path_gets_fixed(self):
        with warnings.catch_warnings(record=True) as w:
            output = update_classpath("scrapy.contrib.debug.Debug")
>       self.assertEqual(output, "scrapy.extensions.debug.Debug")
E       AssertionError: None != 'scrapy.extensions.debug.Debug'

/testbed/tests/test_utils_deprecate.py:283: AssertionError

test_utils_deprecate.py::UpdateClassPathTest::test_returns_nonstring

test_utils_deprecate.py::UpdateClassPathTest::test_returns_nonstring
self = 

    def test_returns_nonstring(self):
        for notastring in [None, True, [1, 2, 3], object()]:
>           self.assertEqual(update_classpath(notastring), notastring)
E           AssertionError: None != True

/testbed/tests/test_utils_deprecate.py:302: AssertionError

test_utils_deprecate.py::UpdateClassPathTest::test_sorted_replacement

test_utils_deprecate.py::UpdateClassPathTest::test_sorted_replacement
self = 

    def test_sorted_replacement(self):
        with warnings.catch_warnings():
            warnings.simplefilter("ignore", ScrapyDeprecationWarning)
            output = update_classpath("scrapy.contrib.pipeline.Pipeline")
>       self.assertEqual(output, "scrapy.pipelines.Pipeline")
E       AssertionError: None != 'scrapy.pipelines.Pipeline'

/testbed/tests/test_utils_deprecate.py:292: AssertionError

test_utils_deprecate.py::UpdateClassPathTest::test_unmatched_path_stays_the_same

test_utils_deprecate.py::UpdateClassPathTest::test_unmatched_path_stays_the_same
self = 

    def test_unmatched_path_stays_the_same(self):
        with warnings.catch_warnings(record=True) as w:
            output = update_classpath("scrapy.unmatched.Path")
>       self.assertEqual(output, "scrapy.unmatched.Path")
E       AssertionError: None != 'scrapy.unmatched.Path'

/testbed/tests/test_utils_deprecate.py:297: AssertionError

test_utils_display.py::TestDisplay::test_pformat

test_utils_display.py::TestDisplay::test_pformat
self = 
isatty = 

    @mock.patch("sys.platform", "linux")
    @mock.patch("sys.stdout.isatty")
    def test_pformat(self, isatty):
        isatty.return_value = True
>       self.assertIn(pformat(self.object), self.colorized_strings)
E       AssertionError: "{'a': 1}" not found in {"{\x1b[33m'\x1b[39;49;00m\x1b[33ma\x1b[39;49;00m\x1b[33m'\x1b[39;49;00m: \x1b[34m1\x1b[39;49;00m}\n", "{\x1b[33m'\x1b[39;49;00m\x1b[33ma\x1b[39;49;00m\x1b[33m'\x1b[39;49;00m: \x1b[34m1\x1b[39;49;00m}\x1b[37m\x1b[39;49;00m\n"}

/testbed/tests/test_utils_display.py:29: AssertionError

test_utils_display.py::TestDisplay::test_pformat_dont_colorize

test_utils_display.py::TestDisplay::test_pformat_dont_colorize
self = 
isatty = 

    @mock.patch("sys.stdout.isatty")
    def test_pformat_dont_colorize(self, isatty):
        isatty.return_value = True
>       self.assertEqual(pformat(self.object, colorize=False), self.plain_string)

/testbed/tests/test_utils_display.py:34: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

obj = {'a': 1}, args = (), kwargs = {'colorize': False}

    def pformat(obj: Any, *args: Any, **kwargs: Any) -> str:
        """Format a Python object into a pretty-printed representation."""
>       return pformat_(obj, *args, **kwargs)
E       TypeError: pformat() got an unexpected keyword argument 'colorize'

/testbed/scrapy/utils/display.py:35: TypeError

test_utils_display.py::TestDisplay::test_pformat_old_windows

test_utils_display.py::TestDisplay::test_pformat_old_windows
self = 
isatty = 
version = 

    @mock.patch("sys.platform", "win32")
    @mock.patch("platform.version")
    @mock.patch("sys.stdout.isatty")
    def test_pformat_old_windows(self, isatty, version):
        isatty.return_value = True
        version.return_value = "10.0.14392"
>       self.assertIn(pformat(self.object), self.colorized_strings)
E       AssertionError: "{'a': 1}" not found in {"{\x1b[33m'\x1b[39;49;00m\x1b[33ma\x1b[39;49;00m\x1b[33m'\x1b[39;49;00m: \x1b[34m1\x1b[39;49;00m}\n", "{\x1b[33m'\x1b[39;49;00m\x1b[33ma\x1b[39;49;00m\x1b[33m'\x1b[39;49;00m: \x1b[34m1\x1b[39;49;00m}\x1b[37m\x1b[39;49;00m\n"}

/testbed/tests/test_utils_display.py:45: AssertionError

test_utils_display.py::TestDisplay::test_pformat_windows

test_utils_display.py::TestDisplay::test_pformat_windows
self = 
isatty = 
version = 
terminal_processing = 

    @mock.patch("sys.platform", "win32")
    @mock.patch("scrapy.utils.display._enable_windows_terminal_processing")
    @mock.patch("platform.version")
    @mock.patch("sys.stdout.isatty")
    def test_pformat_windows(self, isatty, version, terminal_processing):
        isatty.return_value = True
        version.return_value = "10.0.14393"
        terminal_processing.return_value = True
>       self.assertIn(pformat(self.object), self.colorized_strings)
E       AssertionError: "{'a': 1}" not found in {"{\x1b[33m'\x1b[39;49;00m\x1b[33ma\x1b[39;49;00m\x1b[33m'\x1b[39;49;00m: \x1b[34m1\x1b[39;49;00m}\n", "{\x1b[33m'\x1b[39;49;00m\x1b[33ma\x1b[39;49;00m\x1b[33m'\x1b[39;49;00m: \x1b[34m1\x1b[39;49;00m}\x1b[37m\x1b[39;49;00m\n"}

/testbed/tests/test_utils_display.py:67: AssertionError

test_utils_gz.py::GunzipTest::test_gunzip_basic

test_utils_gz.py::GunzipTest::test_gunzip_basic
self = 

    def test_gunzip_basic(self):
        r1 = Response(
            "http://www.example.com",
            body=(SAMPLEDIR / "feed-sample1.xml.gz").read_bytes(),
        )
>       self.assertTrue(gzip_magic_number(r1))
E       TypeError: 'bytes' object is not callable

/testbed/tests/test_utils_gz.py:19: TypeError

test_utils_gz.py::GunzipTest::test_gunzip_illegal_eof

test_utils_gz.py::GunzipTest::test_gunzip_illegal_eof
self = 

    def test_gunzip_illegal_eof(self):
        text = html_to_unicode(
>           "charset=cp1252", gunzip((SAMPLEDIR / "unexpected-eof.gz").read_bytes())
        )[1]

/testbed/tests/test_utils_gz.py:51: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/utils/gz.py:22: in gunzip
    chunk = f.read(_CHUNK_SIZE)
/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/gzip.py:324: in read
    return self._buffer.read(size)
/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/_compression.py:68: in readinto
    data = self.read(len(byte_view))
/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/gzip.py:518: in read
    self._read_eof()
/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/gzip.py:560: in _read_eof
    crc32, isize = struct.unpack(", n = 8

    def _read_exact(fp, n):
        '''Read exactly *n* bytes from `fp`

        This method is required because fp may be unbuffered,
        i.e. return short reads.
        '''
        data = fp.read(n)
        while len(data) < n:
            b = fp.read(n - len(data))
            if not b:
>               raise EOFError("Compressed file ended before the "
                               "end-of-stream marker was reached")
E               EOFError: Compressed file ended before the end-of-stream marker was reached

/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/gzip.py:440: EOFError

test_utils_gz.py::GunzipTest::test_gunzip_no_gzip_file_raises

test_utils_gz.py::GunzipTest::test_gunzip_no_gzip_file_raises
self = 

    def test_gunzip_no_gzip_file_raises(self):
>       self.assertRaises(
            OSError, gunzip, (SAMPLEDIR / "feed-sample1.xml").read_bytes()
        )
E       AssertionError: OSError not raised by gunzip

/testbed/tests/test_utils_gz.py:30: AssertionError

test_utils_gz.py::GunzipTest::test_gunzip_truncated

test_utils_gz.py::GunzipTest::test_gunzip_truncated
self = 

    def test_gunzip_truncated(self):
>       text = gunzip((SAMPLEDIR / "truncated-crc-error.gz").read_bytes())

/testbed/tests/test_utils_gz.py:26: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/utils/gz.py:22: in gunzip
    chunk = f.read(_CHUNK_SIZE)
/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/gzip.py:324: in read
    return self._buffer.read(size)
/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/_compression.py:68: in readinto
    data = self.read(len(byte_view))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = , size = 32768

    def read(self, size=-1):
        if size < 0:
            return self.readall()
        # size=0 is special because decompress(max_length=0) is not supported
        if not size:
            return b""

        # For certain input data, a single
        # call to decompress() may not return
        # any data. In this case, retry until we get some data or reach EOF.
        while True:
            if self._decompressor.eof:
                # Ending case: we've come to the end of a member in the file,
                # so finish up this member, and read a new gzip header.
                # Check the CRC and file size, and set the flag so we read
                # a new member
                self._read_eof()
                self._new_member = True
                self._decompressor = self._decomp_factory(
                    **self._decomp_args)

            if self._new_member:
                # If the _new_member flag is set, we have to
                # jump to the next member, if there is one.
                self._init_read()
                if not self._read_gzip_header():
                    self._size = self._pos
                    return b""
                self._new_member = False

            # Read a chunk of data from the file
            if self._decompressor.needs_input:
                buf = self._fp.read(READ_BUFFER_SIZE)
                uncompress = self._decompressor.decompress(buf, size)
            else:
                uncompress = self._decompressor.decompress(b"", size)

            if self._decompressor.unused_data != b"":
                # Prepend the already read bytes to the fileobj so they can
                # be seen by _read_eof() and _read_gzip_header()
                self._fp.prepend(self._decompressor.unused_data)

            if uncompress != b"":
                break
            if buf == b"":
>               raise EOFError("Compressed file ended before the "
                               "end-of-stream marker was reached")
E               EOFError: Compressed file ended before the end-of-stream marker was reached

/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/gzip.py:547: EOFError

test_utils_gz.py::GunzipTest::test_gunzip_truncated_short

test_utils_gz.py::GunzipTest::test_gunzip_truncated_short
self = 

    def test_gunzip_truncated_short(self):
        r1 = Response(
            "http://www.example.com",
            body=(SAMPLEDIR / "truncated-crc-error-short.gz").read_bytes(),
        )
>       self.assertTrue(gzip_magic_number(r1))
E       TypeError: 'bytes' object is not callable

/testbed/tests/test_utils_gz.py:39: TypeError

test_utils_gz.py::GunzipTest::test_is_gzipped_empty

test_utils_gz.py::GunzipTest::test_is_gzipped_empty
self = 

    def test_is_gzipped_empty(self):
        r1 = Response("http://www.example.com")
>       self.assertFalse(gzip_magic_number(r1))
E       TypeError: 'bytes' object is not callable

/testbed/tests/test_utils_gz.py:47: TypeError

test_utils_httpobj.py::HttpobjUtilsTest::test_urlparse_cached

test_utils_httpobj.py::HttpobjUtilsTest::test_urlparse_cached
self = 

    def test_urlparse_cached(self):
        url = "http://www.example.com/index.html"
        request1 = Request(url)
        request2 = Request(url)
        req1a = urlparse_cached(request1)
        req1b = urlparse_cached(request1)
        req2 = urlparse_cached(request2)
        urlp = urlparse(url)

        assert req1a == req2
>       assert req1a == urlp
E       AssertionError

/testbed/tests/test_utils_httpobj.py:19: AssertionError

test_utils_iterators.py::XmliterTestCase::test_deprecation

test_utils_iterators.py::XmliterTestCase::test_deprecation
self = 

    def test_deprecation(self):
        body = b"""
            
            
              
            
        """
        with pytest.warns(
            ScrapyDeprecationWarning,
            match="xmliter",
        ):
>           next(self.xmliter(body, "product"))

/testbed/tests/test_utils_iterators.py:270: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/utils/iterators.py:66: in xmliter
    yield Selector(text=nodetext, type="xml")
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'Selector' object has no attribute 'type'") raised in repr()] Selector object at 0x7fcb95ea1d30>
response = None, text = '', type = 'xml'
root = , kwargs = {}

    def __init__(self, response: Optional[TextResponse]=None, text: Optional[str]=None, type: Optional[str]=None, root: Optional[Any]=_NOT_SET, **kwargs: Any):
        if response is not None and text is not None:
            raise ValueError(f'{self.__class__.__name__}.__init__() received both response and text')
>       st = _st(response, type)
E       NameError: name '_st' is not defined

/testbed/scrapy/selector/unified.py:55: NameError

During handling of the above exception, another exception occurred:

self = 

    def test_deprecation(self):
        body = b"""
            
            
              
            
        """
>       with pytest.warns(
            ScrapyDeprecationWarning,
            match="xmliter",
        ):
E       Failed: DID NOT WARN. No warnings of type (,) were emitted.
E        Emitted warnings: [].

/testbed/tests/test_utils_iterators.py:266: Failed


test_utils_iterators.py::XmliterTestCase::test_xmliter

test_utils_iterators.py::XmliterTestCase::test_xmliter
self = 

    @pytest.mark.filterwarnings("ignore::scrapy.exceptions.ScrapyDeprecationWarning")
    def test_xmliter(self):
        body = b"""
            
            
              
                Type 1
                Name 1
              
              
                Type 2
                Name 2
              
            
        """

        response = XmlResponse(url="http://example.com", body=body)
        attrs = []
>       for x in self.xmliter(response, "product"):

/testbed/tests/test_utils_iterators.py:30: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/utils/iterators.py:63: in xmliter
    reader = _StreamReader(obj)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
obj = <200 http://example.com>

    def __init__(self, obj: Union[Response, str, bytes]):
        self._ptr: int = 0
        self._text: Union[str, bytes]
        if isinstance(obj, TextResponse):
>           self._text, self.encoding = (obj.body, obj.encoding)
E           AttributeError: 'XmlResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/utils/iterators.py:35: AttributeError

test_utils_iterators.py::XmliterTestCase::test_xmliter_encoding

test_utils_iterators.py::XmliterTestCase::test_xmliter_encoding
self = 

    @pytest.mark.filterwarnings("ignore::scrapy.exceptions.ScrapyDeprecationWarning")
    def test_xmliter_encoding(self):
        body = (
            b'\n'
            b"\n"
            b"    Some Turkish Characters \xd6\xc7\xde\xdd\xd0\xdc \xfc\xf0\xfd\xfe\xe7\xf6\n"
            b"\n\n"
        )
        response = XmlResponse("http://www.example.com", body=body)
        self.assertEqual(
>           next(self.xmliter(response, "item")).get(),
            "Some Turkish Characters \xd6\xc7\u015e\u0130\u011e\xdc \xfc\u011f\u0131\u015f\xe7\xf6",
        )

/testbed/tests/test_utils_iterators.py:251: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/utils/iterators.py:63: in xmliter
    reader = _StreamReader(obj)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
obj = <200 http://www.example.com>

    def __init__(self, obj: Union[Response, str, bytes]):
        self._ptr: int = 0
        self._text: Union[str, bytes]
        if isinstance(obj, TextResponse):
>           self._text, self.encoding = (obj.body, obj.encoding)
E           AttributeError: 'XmlResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/utils/iterators.py:35: AttributeError

test_utils_iterators.py::XmliterTestCase::test_xmliter_exception

test_utils_iterators.py::XmliterTestCase::test_xmliter_exception
self = 

    @pytest.mark.filterwarnings("ignore::scrapy.exceptions.ScrapyDeprecationWarning")
    def test_xmliter_exception(self):
        body = (
            ''
            "onetwo"
        )

        iter = self.xmliter(body, "product")
>       next(iter)

/testbed/tests/test_utils_iterators.py:231: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/utils/iterators.py:66: in xmliter
    yield Selector(text=nodetext, type="xml")
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'Selector' object has no attribute 'type'") raised in repr()] Selector object at 0x7fcb95ec1e10>
response = None, text = 'one', type = 'xml'
root = , kwargs = {}

    def __init__(self, response: Optional[TextResponse]=None, text: Optional[str]=None, type: Optional[str]=None, root: Optional[Any]=_NOT_SET, **kwargs: Any):
        if response is not None and text is not None:
            raise ValueError(f'{self.__class__.__name__}.__init__() received both response and text')
>       st = _st(response, type)
E       NameError: name '_st' is not defined

/testbed/scrapy/selector/unified.py:55: NameError


test_utils_iterators.py::XmliterTestCase::test_xmliter_namespaced_nodename

test_utils_iterators.py::XmliterTestCase::test_xmliter_namespaced_nodename
self = 

    @pytest.mark.filterwarnings("ignore::scrapy.exceptions.ScrapyDeprecationWarning")
    def test_xmliter_namespaced_nodename(self):
        body = b"""
            
            
                
                My Dummy Company
                http://www.mydummycompany.com
                This is a dummy company. We do nothing.
                
                    Item 1
                    This is item 1
                    http://www.mydummycompany.com/items/1
                    http://www.mydummycompany.com/images/item1.jpg
                    ITEM_1
                    400
                
                
            
        """
        response = XmlResponse(url="http://mydummycompany.com", body=body)
        my_iter = self.xmliter(response, "g:image_link")
>       node = next(my_iter)

/testbed/tests/test_utils_iterators.py:191: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/utils/iterators.py:63: in xmliter
    reader = _StreamReader(obj)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
obj = <200 http://mydummycompany.com>

    def __init__(self, obj: Union[Response, str, bytes]):
        self._ptr: int = 0
        self._text: Union[str, bytes]
        if isinstance(obj, TextResponse):
>           self._text, self.encoding = (obj.body, obj.encoding)
E           AttributeError: 'XmlResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/utils/iterators.py:35: AttributeError

test_utils_iterators.py::XmliterTestCase::test_xmliter_namespaced_nodename_missing

test_utils_iterators.py::XmliterTestCase::test_xmliter_namespaced_nodename_missing
self = 

    @pytest.mark.filterwarnings("ignore::scrapy.exceptions.ScrapyDeprecationWarning")
    def test_xmliter_namespaced_nodename_missing(self):
        body = b"""
            
            
                
                My Dummy Company
                http://www.mydummycompany.com
                This is a dummy company. We do nothing.
                
                    Item 1
                    This is item 1
                    http://www.mydummycompany.com/items/1
                    http://www.mydummycompany.com/images/item1.jpg
                    ITEM_1
                    400
                
                
            
        """
        response = XmlResponse(url="http://mydummycompany.com", body=body)
        my_iter = self.xmliter(response, "g:link_image")
        with self.assertRaises(StopIteration):
>           next(my_iter)

/testbed/tests/test_utils_iterators.py:221: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/utils/iterators.py:63: in xmliter
    reader = _StreamReader(obj)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
obj = <200 http://mydummycompany.com>

    def __init__(self, obj: Union[Response, str, bytes]):
        self._ptr: int = 0
        self._text: Union[str, bytes]
        if isinstance(obj, TextResponse):
>           self._text, self.encoding = (obj.body, obj.encoding)
E           AttributeError: 'XmlResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/utils/iterators.py:35: AttributeError

During handling of the above exception, another exception occurred:

self = 

    @pytest.mark.filterwarnings("ignore::scrapy.exceptions.ScrapyDeprecationWarning")
    def test_xmliter_namespaced_nodename_missing(self):
        body = b"""
            
            
                
                My Dummy Company
                http://www.mydummycompany.com
                This is a dummy company. We do nothing.
                
                    Item 1
                    This is item 1
                    http://www.mydummycompany.com/items/1
                    http://www.mydummycompany.com/images/item1.jpg
                    ITEM_1
                    400
                
                
            
        """
        response = XmlResponse(url="http://mydummycompany.com", body=body)
        my_iter = self.xmliter(response, "g:link_image")
>       with self.assertRaises(StopIteration):

/testbed/tests/test_utils_iterators.py:220: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py:355: in __exit__
    self._testCase.fail(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
msg = 'builtins.AttributeError raised instead of StopIteration:\n Traceback (most recent call last):\n  File "/testbed/.venv...f.encoding = (obj.body, obj.encoding)\nbuiltins.AttributeError: \'XmlResponse\' object has no attribute \'encoding\'\n'

    def fail(self, msg: Optional[object] = None) -> NoReturn:
        """
        Absolutely fail the test.  Do not pass go, do not collect $200.

        @param msg: the message that will be displayed as the reason for the
        failure
        """
>       raise self.failureException(msg)
E       twisted.trial.unittest.FailTest: builtins.AttributeError raised instead of StopIteration:
E        Traceback (most recent call last):
E         File "/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_asynctest.py", line 124, in _run
E           d = defer.maybeDeferred(
E         File "/testbed/.venv/lib/python3.12/site-packages/twisted/internet/defer.py", line 212, in maybeDeferred
E           result = f(*args, **kwargs)
E         File "/testbed/.venv/lib/python3.12/site-packages/twisted/internet/utils.py", line 223, in runWithWarningsSuppressed
E           result = f(*a, **kw)
E         File "/testbed/tests/test_utils_iterators.py", line 220, in test_xmliter_namespaced_nodename_missing
E           with self.assertRaises(StopIteration):
E       ---  ---
E         File "/testbed/tests/test_utils_iterators.py", line 221, in test_xmliter_namespaced_nodename_missing
E           next(my_iter)
E         File "/testbed/scrapy/utils/iterators.py", line 63, in xmliter
E           reader = _StreamReader(obj)
E         File "/testbed/scrapy/utils/iterators.py", line 35, in __init__
E           self._text, self.encoding = (obj.body, obj.encoding)
E       builtins.AttributeError: 'XmlResponse' object has no attribute 'encoding'

/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py:381: FailTest

test_utils_iterators.py::XmliterTestCase::test_xmliter_namespaces

test_utils_iterators.py::XmliterTestCase::test_xmliter_namespaces
self = 

    @pytest.mark.filterwarnings("ignore::scrapy.exceptions.ScrapyDeprecationWarning")
    def test_xmliter_namespaces(self):
        body = b"""
            
            
                
                My Dummy Company
                http://www.mydummycompany.com
                This is a dummy company. We do nothing.
                
                    Item 1
                    This is item 1
                    http://www.mydummycompany.com/items/1
                    http://www.mydummycompany.com/images/item1.jpg
                    ITEM_1
                    400
                
                
            
        """
        response = XmlResponse(url="http://mydummycompany.com", body=body)
        my_iter = self.xmliter(response, "item")
>       node = next(my_iter)

/testbed/tests/test_utils_iterators.py:151: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/utils/iterators.py:63: in xmliter
    reader = _StreamReader(obj)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
obj = <200 http://mydummycompany.com>

    def __init__(self, obj: Union[Response, str, bytes]):
        self._ptr: int = 0
        self._text: Union[str, bytes]
        if isinstance(obj, TextResponse):
>           self._text, self.encoding = (obj.body, obj.encoding)
E           AttributeError: 'XmlResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/utils/iterators.py:35: AttributeError

test_utils_iterators.py::XmliterTestCase::test_xmliter_objtype_exception

test_utils_iterators.py::XmliterTestCase::test_xmliter_objtype_exception
self = 
obj = . at 0x7fcb95c9aca0>

    def _handle(self, obj):
        """
        Call the given object using this object as a context manager.

        @param obj: The object to call and which is expected to raise some
            exception.
        @type obj: L{object}

        @return: Whatever exception is raised by C{obj()}.
        @rtype: L{BaseException}
        """
        with self as context:
>           self._returnValue = obj()

/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py:321: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py:430: in 
    return context._handle(lambda: f(*args, **kwargs))
/testbed/scrapy/utils/iterators.py:64: in xmliter
    for match in re.finditer(rf"<{nodename_patt}[\s>].*?", reader.read(), re.DOTALL):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = , n = -1

    def read(self, n: int=-1) -> str:
        """Returns a string from the given position and updates the internal pointer."""
        assert n <= 0 or n is None  # only reads all data
        if self._is_first_read:
            self._is_first_read = False
            if not self._is_unicode:
>               self._text = self._text.decode(self.encoding)
E               AttributeError: 'int' object has no attribute 'decode'

/testbed/scrapy/utils/iterators.py:49: AttributeError

During handling of the above exception, another exception occurred:

self = 

    @pytest.mark.filterwarnings("ignore::scrapy.exceptions.ScrapyDeprecationWarning")
    def test_xmliter_objtype_exception(self):
        i = self.xmliter(42, "product")
>       self.assertRaises(TypeError, next, i)

/testbed/tests/test_utils_iterators.py:239: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py:430: in assertRaises
    return context._handle(lambda: f(*args, **kwargs))
/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py:320: in _handle
    with self as context:
/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py:355: in __exit__
    self._testCase.fail(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
msg = 'builtins.AttributeError raised instead of TypeError:\n Traceback (most recent call last):\n  File "/testbed/.venv/lib...  self._text = self._text.decode(self.encoding)\nbuiltins.AttributeError: \'int\' object has no attribute \'decode\'\n'

    def fail(self, msg: Optional[object] = None) -> NoReturn:
        """
        Absolutely fail the test.  Do not pass go, do not collect $200.

        @param msg: the message that will be displayed as the reason for the
        failure
        """
>       raise self.failureException(msg)
E       twisted.trial.unittest.FailTest: builtins.AttributeError raised instead of TypeError:
E        Traceback (most recent call last):
E         File "/testbed/.venv/lib/python3.12/site-packages/twisted/internet/utils.py", line 223, in runWithWarningsSuppressed
E           result = f(*a, **kw)
E         File "/testbed/tests/test_utils_iterators.py", line 239, in test_xmliter_objtype_exception
E           self.assertRaises(TypeError, next, i)
E         File "/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py", line 430, in assertRaises
E           return context._handle(lambda: f(*args, **kwargs))
E         File "/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py", line 320, in _handle
E           with self as context:
E       ---  ---
E         File "/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py", line 321, in _handle
E           self._returnValue = obj()
E         File "/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py", line 430, in 
E           return context._handle(lambda: f(*args, **kwargs))
E         File "/testbed/scrapy/utils/iterators.py", line 64, in xmliter
E           for match in re.finditer(rf"<{nodename_patt}[\s>].*?", reader.read(), re.DOTALL):
E         File "/testbed/scrapy/utils/iterators.py", line 49, in read
E           self._text = self._text.decode(self.encoding)
E       builtins.AttributeError: 'int' object has no attribute 'decode'

/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py:381: FailTest

test_utils_iterators.py::XmliterTestCase::test_xmliter_text

test_utils_iterators.py::XmliterTestCase::test_xmliter_text
self = 

    @pytest.mark.filterwarnings("ignore::scrapy.exceptions.ScrapyDeprecationWarning")
    def test_xmliter_text(self):
        body = (
            ''
            "onetwo"
        )

        self.assertEqual(
>           [x.xpath("text()").getall() for x in self.xmliter(body, "product")],
            [["one"], ["two"]],
        )

/testbed/tests/test_utils_iterators.py:125: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/utils/iterators.py:66: in xmliter
    yield Selector(text=nodetext, type="xml")
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'Selector' object has no attribute 'type'") raised in repr()] Selector object at 0x7fcb95ed8590>
response = None, text = 'one', type = 'xml'
root = , kwargs = {}

    def __init__(self, response: Optional[TextResponse]=None, text: Optional[str]=None, type: Optional[str]=None, root: Optional[Any]=_NOT_SET, **kwargs: Any):
        if response is not None and text is not None:
            raise ValueError(f'{self.__class__.__name__}.__init__() received both response and text')
>       st = _st(response, type)
E       NameError: name '_st' is not defined

/testbed/scrapy/selector/unified.py:55: NameError


test_utils_iterators.py::XmliterTestCase::test_xmliter_unicode

test_utils_iterators.py::XmliterTestCase::test_xmliter_unicode
self = 

    @pytest.mark.filterwarnings("ignore::scrapy.exceptions.ScrapyDeprecationWarning")
    def test_xmliter_unicode(self):
        # example taken from https://github.com/scrapy/scrapy/issues/1665
        body = """
            <þingflokkar>
               <þingflokkur id="26">
                  
                  
                     -
                     
                  
                  
                     80
                  
               
               <þingflokkur id="21">
                  Alþýðubandalag
                  
                     Ab
                     Alþb.
                  
                  
                     76
                     123
                  
               
               <þingflokkur id="27">
                  Alþýðuflokkur
                  
                     A
                     Alþfl.
                  
                  
                     27
                     120
                  
               
            """

        for r in (
            # with bytes
            XmlResponse(url="http://example.com", body=body.encode("utf-8")),
            # Unicode body needs encoding information
>           XmlResponse(url="http://example.com", body=body, encoding="utf-8"),
        ):

/testbed/tests/test_utils_iterators.py:100: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/http/response/text.py:33: in __init__
    super().__init__(*args, **kwargs)
/testbed/scrapy/http/response/__init__.py:55: in __init__
    self._set_body(body)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'XmlResponse' object has no attribute '_url'") raised in repr()] XmlResponse object at 0x7fcb95db88f0>
body = '\n            <þingflokkar>\n               <þingflokkur id="26">\n            ...síðastaþing>120\n                  \n               \n            '

    def _set_body(self, body):
        if body is None:
            self._body = b""
        elif not isinstance(body, bytes):
>           raise TypeError(
                "Response body must be bytes. "
                "If you want to pass unicode body use TextResponse "
                "or HtmlResponse."
            )
E           TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse.

/testbed/scrapy/http/response/__init__.py:103: TypeError

test_utils_iterators.py::XmliterTestCase::test_xmliter_unusual_node

test_utils_iterators.py::XmliterTestCase::test_xmliter_unusual_node
self = 

    @pytest.mark.filterwarnings("ignore::scrapy.exceptions.ScrapyDeprecationWarning")
    def test_xmliter_unusual_node(self):
        body = b"""
            
                
                
            
        """
        response = XmlResponse(url="http://example.com", body=body)
        nodenames = [
>           e.xpath("name()").getall() for e in self.xmliter(response, "matchme...")
        ]

/testbed/tests/test_utils_iterators.py:53: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/utils/iterators.py:63: in xmliter
    reader = _StreamReader(obj)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
obj = <200 http://example.com>

    def __init__(self, obj: Union[Response, str, bytes]):
        self._ptr: int = 0
        self._text: Union[str, bytes]
        if isinstance(obj, TextResponse):
>           self._text, self.encoding = (obj.body, obj.encoding)
E           AttributeError: 'XmlResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/utils/iterators.py:35: AttributeError

test_utils_iterators.py::LxmlXmliterTestCase::test_xmliter

test_utils_iterators.py::LxmlXmliterTestCase::test_xmliter
self = 

    @pytest.mark.filterwarnings("ignore::scrapy.exceptions.ScrapyDeprecationWarning")
    def test_xmliter(self):
        body = b"""
            
            
              
                Type 1
                Name 1
              
              
                Type 2
                Name 2
              
            
        """

        response = XmlResponse(url="http://example.com", body=body)
        attrs = []
>       for x in self.xmliter(response, "product"):

/testbed/tests/test_utils_iterators.py:30: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/utils/iterators.py:91: in xmliter_lxml
    reader = _StreamReader(obj)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
obj = <200 http://example.com>

    def __init__(self, obj: Union[Response, str, bytes]):
        self._ptr: int = 0
        self._text: Union[str, bytes]
        if isinstance(obj, TextResponse):
>           self._text, self.encoding = (obj.body, obj.encoding)
E           AttributeError: 'XmlResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/utils/iterators.py:35: AttributeError

test_utils_iterators.py::LxmlXmliterTestCase::test_xmliter_encoding

test_utils_iterators.py::LxmlXmliterTestCase::test_xmliter_encoding
self = 

    @pytest.mark.filterwarnings("ignore::scrapy.exceptions.ScrapyDeprecationWarning")
    def test_xmliter_encoding(self):
        body = (
            b'\n'
            b"\n"
            b"    Some Turkish Characters \xd6\xc7\xde\xdd\xd0\xdc \xfc\xf0\xfd\xfe\xe7\xf6\n"
            b"\n\n"
        )
        response = XmlResponse("http://www.example.com", body=body)
        self.assertEqual(
>           next(self.xmliter(response, "item")).get(),
            "Some Turkish Characters \xd6\xc7\u015e\u0130\u011e\xdc \xfc\u011f\u0131\u015f\xe7\xf6",
        )

/testbed/tests/test_utils_iterators.py:251: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/utils/iterators.py:91: in xmliter_lxml
    reader = _StreamReader(obj)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
obj = <200 http://www.example.com>

    def __init__(self, obj: Union[Response, str, bytes]):
        self._ptr: int = 0
        self._text: Union[str, bytes]
        if isinstance(obj, TextResponse):
>           self._text, self.encoding = (obj.body, obj.encoding)
E           AttributeError: 'XmlResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/utils/iterators.py:35: AttributeError

test_utils_iterators.py::LxmlXmliterTestCase::test_xmliter_exception

test_utils_iterators.py::LxmlXmliterTestCase::test_xmliter_exception
self = 

    @pytest.mark.filterwarnings("ignore::scrapy.exceptions.ScrapyDeprecationWarning")
    def test_xmliter_exception(self):
        body = (
            ''
            "onetwo"
        )

        iter = self.xmliter(body, "product")
>       next(iter)

/testbed/tests/test_utils_iterators.py:231: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/utils/iterators.py:96: in xmliter_lxml
    for event, node in parser:
src/lxml/iterparse.pxi:208: in lxml.etree.iterparse.__next__
    ???
src/lxml/iterparse.pxi:193: in lxml.etree.iterparse.__next__
    ???
src/lxml/iterparse.pxi:218: in lxml.etree.iterparse._read_more_events
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
n = 32768

    def read(self, n: int=-1) -> str:
        """Returns a string from the given position and updates the internal pointer."""
>       assert n <= 0 or n is None  # only reads all data
E       AssertionError

/testbed/scrapy/utils/iterators.py:45: AssertionError

test_utils_iterators.py::LxmlXmliterTestCase::test_xmliter_iterate_namespace

test_utils_iterators.py::LxmlXmliterTestCase::test_xmliter_iterate_namespace
self = 

    def test_xmliter_iterate_namespace(self):
        body = b"""
            
            
                
                My Dummy Company
                http://www.mydummycompany.com
                This is a dummy company. We do nothing.
                
                    Item 1
                    This is item 1
                    http://www.mydummycompany.com/items/1
                    http://www.mydummycompany.com/images/item1.jpg
                    http://www.mydummycompany.com/images/item2.jpg
                
                
            
        """
        response = XmlResponse(url="http://mydummycompany.com", body=body)

        no_namespace_iter = self.xmliter(response, "image_link")
>       self.assertEqual(len(list(no_namespace_iter)), 0)

/testbed/tests/test_utils_iterators.py:297: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/utils/iterators.py:91: in xmliter_lxml
    reader = _StreamReader(obj)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
obj = <200 http://mydummycompany.com>

    def __init__(self, obj: Union[Response, str, bytes]):
        self._ptr: int = 0
        self._text: Union[str, bytes]
        if isinstance(obj, TextResponse):
>           self._text, self.encoding = (obj.body, obj.encoding)
E           AttributeError: 'XmlResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/utils/iterators.py:35: AttributeError

test_utils_iterators.py::LxmlXmliterTestCase::test_xmliter_namespaced_nodename

test_utils_iterators.py::LxmlXmliterTestCase::test_xmliter_namespaced_nodename
self = 

    @pytest.mark.filterwarnings("ignore::scrapy.exceptions.ScrapyDeprecationWarning")
    def test_xmliter_namespaced_nodename(self):
        body = b"""
            
            
                
                My Dummy Company
                http://www.mydummycompany.com
                This is a dummy company. We do nothing.
                
                    Item 1
                    This is item 1
                    http://www.mydummycompany.com/items/1
                    http://www.mydummycompany.com/images/item1.jpg
                    ITEM_1
                    400
                
                
            
        """
        response = XmlResponse(url="http://mydummycompany.com", body=body)
        my_iter = self.xmliter(response, "g:image_link")
>       node = next(my_iter)

/testbed/tests/test_utils_iterators.py:191: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/utils/iterators.py:91: in xmliter_lxml
    reader = _StreamReader(obj)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
obj = <200 http://mydummycompany.com>

    def __init__(self, obj: Union[Response, str, bytes]):
        self._ptr: int = 0
        self._text: Union[str, bytes]
        if isinstance(obj, TextResponse):
>           self._text, self.encoding = (obj.body, obj.encoding)
E           AttributeError: 'XmlResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/utils/iterators.py:35: AttributeError

test_utils_iterators.py::LxmlXmliterTestCase::test_xmliter_namespaced_nodename_missing

test_utils_iterators.py::LxmlXmliterTestCase::test_xmliter_namespaced_nodename_missing
self = 

    @pytest.mark.filterwarnings("ignore::scrapy.exceptions.ScrapyDeprecationWarning")
    def test_xmliter_namespaced_nodename_missing(self):
        body = b"""
            
            
                
                My Dummy Company
                http://www.mydummycompany.com
                This is a dummy company. We do nothing.
                
                    Item 1
                    This is item 1
                    http://www.mydummycompany.com/items/1
                    http://www.mydummycompany.com/images/item1.jpg
                    ITEM_1
                    400
                
                
            
        """
        response = XmlResponse(url="http://mydummycompany.com", body=body)
        my_iter = self.xmliter(response, "g:link_image")
        with self.assertRaises(StopIteration):
>           next(my_iter)

/testbed/tests/test_utils_iterators.py:221: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/utils/iterators.py:91: in xmliter_lxml
    reader = _StreamReader(obj)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
obj = <200 http://mydummycompany.com>

    def __init__(self, obj: Union[Response, str, bytes]):
        self._ptr: int = 0
        self._text: Union[str, bytes]
        if isinstance(obj, TextResponse):
>           self._text, self.encoding = (obj.body, obj.encoding)
E           AttributeError: 'XmlResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/utils/iterators.py:35: AttributeError

During handling of the above exception, another exception occurred:

self = 

    @pytest.mark.filterwarnings("ignore::scrapy.exceptions.ScrapyDeprecationWarning")
    def test_xmliter_namespaced_nodename_missing(self):
        body = b"""
            
            
                
                My Dummy Company
                http://www.mydummycompany.com
                This is a dummy company. We do nothing.
                
                    Item 1
                    This is item 1
                    http://www.mydummycompany.com/items/1
                    http://www.mydummycompany.com/images/item1.jpg
                    ITEM_1
                    400
                
                
            
        """
        response = XmlResponse(url="http://mydummycompany.com", body=body)
        my_iter = self.xmliter(response, "g:link_image")
>       with self.assertRaises(StopIteration):

/testbed/tests/test_utils_iterators.py:220: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py:355: in __exit__
    self._testCase.fail(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
msg = 'builtins.AttributeError raised instead of StopIteration:\n Traceback (most recent call last):\n  File "/testbed/.venv...f.encoding = (obj.body, obj.encoding)\nbuiltins.AttributeError: \'XmlResponse\' object has no attribute \'encoding\'\n'

    def fail(self, msg: Optional[object] = None) -> NoReturn:
        """
        Absolutely fail the test.  Do not pass go, do not collect $200.

        @param msg: the message that will be displayed as the reason for the
        failure
        """
>       raise self.failureException(msg)
E       twisted.trial.unittest.FailTest: builtins.AttributeError raised instead of StopIteration:
E        Traceback (most recent call last):
E         File "/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_asynctest.py", line 124, in _run
E           d = defer.maybeDeferred(
E         File "/testbed/.venv/lib/python3.12/site-packages/twisted/internet/defer.py", line 212, in maybeDeferred
E           result = f(*args, **kwargs)
E         File "/testbed/.venv/lib/python3.12/site-packages/twisted/internet/utils.py", line 223, in runWithWarningsSuppressed
E           result = f(*a, **kw)
E         File "/testbed/tests/test_utils_iterators.py", line 220, in test_xmliter_namespaced_nodename_missing
E           with self.assertRaises(StopIteration):
E       ---  ---
E         File "/testbed/tests/test_utils_iterators.py", line 221, in test_xmliter_namespaced_nodename_missing
E           next(my_iter)
E         File "/testbed/scrapy/utils/iterators.py", line 91, in xmliter_lxml
E           reader = _StreamReader(obj)
E         File "/testbed/scrapy/utils/iterators.py", line 35, in __init__
E           self._text, self.encoding = (obj.body, obj.encoding)
E       builtins.AttributeError: 'XmlResponse' object has no attribute 'encoding'

/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py:381: FailTest

test_utils_iterators.py::LxmlXmliterTestCase::test_xmliter_namespaces

test_utils_iterators.py::LxmlXmliterTestCase::test_xmliter_namespaces
self = 

    @pytest.mark.filterwarnings("ignore::scrapy.exceptions.ScrapyDeprecationWarning")
    def test_xmliter_namespaces(self):
        body = b"""
            
            
                
                My Dummy Company
                http://www.mydummycompany.com
                This is a dummy company. We do nothing.
                
                    Item 1
                    This is item 1
                    http://www.mydummycompany.com/items/1
                    http://www.mydummycompany.com/images/item1.jpg
                    ITEM_1
                    400
                
                
            
        """
        response = XmlResponse(url="http://mydummycompany.com", body=body)
        my_iter = self.xmliter(response, "item")
>       node = next(my_iter)

/testbed/tests/test_utils_iterators.py:151: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/utils/iterators.py:91: in xmliter_lxml
    reader = _StreamReader(obj)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
obj = <200 http://mydummycompany.com>

    def __init__(self, obj: Union[Response, str, bytes]):
        self._ptr: int = 0
        self._text: Union[str, bytes]
        if isinstance(obj, TextResponse):
>           self._text, self.encoding = (obj.body, obj.encoding)
E           AttributeError: 'XmlResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/utils/iterators.py:35: AttributeError

test_utils_iterators.py::LxmlXmliterTestCase::test_xmliter_namespaces_prefix

test_utils_iterators.py::LxmlXmliterTestCase::test_xmliter_namespaces_prefix
self = 

    def test_xmliter_namespaces_prefix(self):
        body = b"""
        
        
            
              
                Apples
                Bananas
              
            

            
              African Coffee Table
              80
              120
            

        
        """
        response = XmlResponse(url="http://mydummycompany.com", body=body)
        my_iter = self.xmliter(response, "table", "http://www.w3.org/TR/html4/", "h")

>       node = next(my_iter)

/testbed/tests/test_utils_iterators.py:335: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/utils/iterators.py:91: in xmliter_lxml
    reader = _StreamReader(obj)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
obj = <200 http://mydummycompany.com>

    def __init__(self, obj: Union[Response, str, bytes]):
        self._ptr: int = 0
        self._text: Union[str, bytes]
        if isinstance(obj, TextResponse):
>           self._text, self.encoding = (obj.body, obj.encoding)
E           AttributeError: 'XmlResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/utils/iterators.py:35: AttributeError

test_utils_iterators.py::LxmlXmliterTestCase::test_xmliter_objtype_exception

test_utils_iterators.py::LxmlXmliterTestCase::test_xmliter_objtype_exception
self = 
obj = . at 0x7fcb95c9ac00>

    def _handle(self, obj):
        """
        Call the given object using this object as a context manager.

        @param obj: The object to call and which is expected to raise some
            exception.
        @type obj: L{object}

        @return: Whatever exception is raised by C{obj()}.
        @rtype: L{BaseException}
        """
        with self as context:
>           self._returnValue = obj()

/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py:321: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py:430: in 
    return context._handle(lambda: f(*args, **kwargs))
/testbed/scrapy/utils/iterators.py:96: in xmliter_lxml
    for event, node in parser:
src/lxml/iterparse.pxi:208: in lxml.etree.iterparse.__next__
    ???
src/lxml/iterparse.pxi:193: in lxml.etree.iterparse.__next__
    ???
src/lxml/iterparse.pxi:218: in lxml.etree.iterparse._read_more_events
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
n = 32768

    def read(self, n: int=-1) -> str:
        """Returns a string from the given position and updates the internal pointer."""
>       assert n <= 0 or n is None  # only reads all data
E       AssertionError

/testbed/scrapy/utils/iterators.py:45: AssertionError

During handling of the above exception, another exception occurred:

self = 

    def test_xmliter_objtype_exception(self):
        i = self.xmliter(42, "product")
>       self.assertRaises(TypeError, next, i)

/testbed/tests/test_utils_iterators.py:349: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py:430: in assertRaises
    return context._handle(lambda: f(*args, **kwargs))
/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py:320: in _handle
    with self as context:
/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py:355: in __exit__
    self._testCase.fail(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
msg = 'builtins.AssertionError raised instead of TypeError:\n Traceback (most recent call last):\n  File "/testbed/.venv/lib...ls/iterators.py", line 45, in read\n    assert n <= 0 or n is None  # only reads all data\nbuiltins.AssertionError: \n'

    def fail(self, msg: Optional[object] = None) -> NoReturn:
        """
        Absolutely fail the test.  Do not pass go, do not collect $200.

        @param msg: the message that will be displayed as the reason for the
        failure
        """
>       raise self.failureException(msg)
E       twisted.trial.unittest.FailTest: builtins.AssertionError raised instead of TypeError:
E        Traceback (most recent call last):
E         File "/testbed/.venv/lib/python3.12/site-packages/twisted/internet/utils.py", line 223, in runWithWarningsSuppressed
E           result = f(*a, **kw)
E         File "/testbed/tests/test_utils_iterators.py", line 349, in test_xmliter_objtype_exception
E           self.assertRaises(TypeError, next, i)
E         File "/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py", line 430, in assertRaises
E           return context._handle(lambda: f(*args, **kwargs))
E         File "/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py", line 320, in _handle
E           with self as context:
E       ---  ---
E         File "/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py", line 321, in _handle
E           self._returnValue = obj()
E         File "/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py", line 430, in 
E           return context._handle(lambda: f(*args, **kwargs))
E         File "/testbed/scrapy/utils/iterators.py", line 96, in xmliter_lxml
E           for event, node in parser:
E         File "src/lxml/iterparse.pxi", line 208, in lxml.etree.iterparse.__next__
E           
E         File "src/lxml/iterparse.pxi", line 193, in lxml.etree.iterparse.__next__
E           
E         File "src/lxml/iterparse.pxi", line 218, in lxml.etree.iterparse._read_more_events
E           
E         File "/testbed/scrapy/utils/iterators.py", line 45, in read
E           assert n <= 0 or n is None  # only reads all data
E       builtins.AssertionError:

/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py:381: FailTest

test_utils_iterators.py::LxmlXmliterTestCase::test_xmliter_text

test_utils_iterators.py::LxmlXmliterTestCase::test_xmliter_text
self = 

    @pytest.mark.filterwarnings("ignore::scrapy.exceptions.ScrapyDeprecationWarning")
    def test_xmliter_text(self):
        body = (
            ''
            "onetwo"
        )

        self.assertEqual(
>           [x.xpath("text()").getall() for x in self.xmliter(body, "product")],
            [["one"], ["two"]],
        )

/testbed/tests/test_utils_iterators.py:125: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/utils/iterators.py:96: in xmliter_lxml
    for event, node in parser:
src/lxml/iterparse.pxi:208: in lxml.etree.iterparse.__next__
    ???
src/lxml/iterparse.pxi:193: in lxml.etree.iterparse.__next__
    ???
src/lxml/iterparse.pxi:218: in lxml.etree.iterparse._read_more_events
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
n = 32768

    def read(self, n: int=-1) -> str:
        """Returns a string from the given position and updates the internal pointer."""
>       assert n <= 0 or n is None  # only reads all data
E       AssertionError

/testbed/scrapy/utils/iterators.py:45: AssertionError

test_utils_iterators.py::LxmlXmliterTestCase::test_xmliter_unicode

test_utils_iterators.py::LxmlXmliterTestCase::test_xmliter_unicode
self = 

    @pytest.mark.filterwarnings("ignore::scrapy.exceptions.ScrapyDeprecationWarning")
    def test_xmliter_unicode(self):
        # example taken from https://github.com/scrapy/scrapy/issues/1665
        body = """
            <þingflokkar>
               <þingflokkur id="26">
                  
                  
                     -
                     
                  
                  
                     80
                  
               
               <þingflokkur id="21">
                  Alþýðubandalag
                  
                     Ab
                     Alþb.
                  
                  
                     76
                     123
                  
               
               <þingflokkur id="27">
                  Alþýðuflokkur
                  
                     A
                     Alþfl.
                  
                  
                     27
                     120
                  
               
            """

        for r in (
            # with bytes
            XmlResponse(url="http://example.com", body=body.encode("utf-8")),
            # Unicode body needs encoding information
>           XmlResponse(url="http://example.com", body=body, encoding="utf-8"),
        ):

/testbed/tests/test_utils_iterators.py:100: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/http/response/text.py:33: in __init__
    super().__init__(*args, **kwargs)
/testbed/scrapy/http/response/__init__.py:55: in __init__
    self._set_body(body)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[AttributeError("'XmlResponse' object has no attribute '_url'") raised in repr()] XmlResponse object at 0x7fcb95d336e0>
body = '\n            <þingflokkar>\n               <þingflokkur id="26">\n            ...síðastaþing>120\n                  \n               \n            '

    def _set_body(self, body):
        if body is None:
            self._body = b""
        elif not isinstance(body, bytes):
>           raise TypeError(
                "Response body must be bytes. "
                "If you want to pass unicode body use TextResponse "
                "or HtmlResponse."
            )
E           TypeError: Response body must be bytes. If you want to pass unicode body use TextResponse or HtmlResponse.

/testbed/scrapy/http/response/__init__.py:103: TypeError

test_utils_iterators.py::LxmlXmliterTestCase::test_xmliter_unusual_node

test_utils_iterators.py::LxmlXmliterTestCase::test_xmliter_unusual_node
self = 

    @pytest.mark.filterwarnings("ignore::scrapy.exceptions.ScrapyDeprecationWarning")
    def test_xmliter_unusual_node(self):
        body = b"""
            
                
                
            
        """
        response = XmlResponse(url="http://example.com", body=body)
        nodenames = [
>           e.xpath("name()").getall() for e in self.xmliter(response, "matchme...")
        ]

/testbed/tests/test_utils_iterators.py:53: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/utils/iterators.py:91: in xmliter_lxml
    reader = _StreamReader(obj)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
obj = <200 http://example.com>

    def __init__(self, obj: Union[Response, str, bytes]):
        self._ptr: int = 0
        self._text: Union[str, bytes]
        if isinstance(obj, TextResponse):
>           self._text, self.encoding = (obj.body, obj.encoding)
E           AttributeError: 'XmlResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/utils/iterators.py:35: AttributeError

test_utils_iterators.py::UtilsCsvTestCase::test_csviter_defaults

test_utils_iterators.py::UtilsCsvTestCase::test_csviter_defaults
self = 

    def test_csviter_defaults(self):
        body = get_testdata("feeds", "feed-sample3.csv")
        response = TextResponse(url="http://example.com/", body=body)
        csv = csviter(response)

>       result = [row for row in csv]

/testbed/tests/test_utils_iterators.py:358: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

obj = <200 http://example.com/>, delimiter = None, headers = None
encoding = None, quotechar = None

    def csviter(obj: Union[Response, str, bytes], delimiter: Optional[str]=None, headers: Optional[List[str]]=None, encoding: Optional[str]=None, quotechar: Optional[str]=None) -> Generator[Dict[str, str], Any, None]:
        """Returns an iterator of dictionaries from the given csv object

        obj can be:
        - a Response object
        - a unicode string
        - a string encoded as utf-8

        delimiter is the character used to separate fields on the given obj.

        headers is an iterable that when provided offers the keys
        for the returned dictionaries, if not the first row is used.

        quotechar is the character used to enclosure fields on the given obj.
        """
        def _getrow(csv_r):
            return [to_unicode(field, encoding) for field in next(csv_r)]

>       encoding = obj.encoding if isinstance(obj, TextResponse) else encoding or "utf-8"
E       AttributeError: 'TextResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/utils/iterators.py:122: AttributeError

test_utils_iterators.py::UtilsCsvTestCase::test_csviter_delimiter

test_utils_iterators.py::UtilsCsvTestCase::test_csviter_delimiter
self = 

    def test_csviter_delimiter(self):
        body = get_testdata("feeds", "feed-sample3.csv").replace(b",", b"\t")
        response = TextResponse(url="http://example.com/", body=body)
        csv = csviter(response, delimiter="\t")

        self.assertEqual(
>           [row for row in csv],
            [
                {"id": "1", "name": "alpha", "value": "foobar"},
                {"id": "2", "name": "unicode", "value": "\xfan\xedc\xf3d\xe9\u203d"},
                {"id": "3", "name": "multi", "value": "foo\nbar"},
                {"id": "4", "name": "empty", "value": ""},
            ],
        )

/testbed/tests/test_utils_iterators.py:380: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

obj = <200 http://example.com/>, delimiter = '\t', headers = None
encoding = None, quotechar = None

    def csviter(obj: Union[Response, str, bytes], delimiter: Optional[str]=None, headers: Optional[List[str]]=None, encoding: Optional[str]=None, quotechar: Optional[str]=None) -> Generator[Dict[str, str], Any, None]:
        """Returns an iterator of dictionaries from the given csv object

        obj can be:
        - a Response object
        - a unicode string
        - a string encoded as utf-8

        delimiter is the character used to separate fields on the given obj.

        headers is an iterable that when provided offers the keys
        for the returned dictionaries, if not the first row is used.

        quotechar is the character used to enclosure fields on the given obj.
        """
        def _getrow(csv_r):
            return [to_unicode(field, encoding) for field in next(csv_r)]

>       encoding = obj.encoding if isinstance(obj, TextResponse) else encoding or "utf-8"
E       AttributeError: 'TextResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/utils/iterators.py:122: AttributeError

test_utils_iterators.py::UtilsCsvTestCase::test_csviter_delimiter_binary_response_assume_utf8_encoding

test_utils_iterators.py::UtilsCsvTestCase::test_csviter_delimiter_binary_response_assume_utf8_encoding
obj = <200 http://example.com/>, delimiter = '\t'
headers = ['id', 'name', 'value'], encoding = 'utf-8', quotechar = None

    def csviter(obj: Union[Response, str, bytes], delimiter: Optional[str]=None, headers: Optional[List[str]]=None, encoding: Optional[str]=None, quotechar: Optional[str]=None) -> Generator[Dict[str, str], Any, None]:
        """Returns an iterator of dictionaries from the given csv object

        obj can be:
        - a Response object
        - a unicode string
        - a string encoded as utf-8

        delimiter is the character used to separate fields on the given obj.

        headers is an iterable that when provided offers the keys
        for the returned dictionaries, if not the first row is used.

        quotechar is the character used to enclosure fields on the given obj.
        """
        def _getrow(csv_r):
            return [to_unicode(field, encoding) for field in next(csv_r)]

        encoding = obj.encoding if isinstance(obj, TextResponse) else encoding or "utf-8"

        # Python 3's csv.reader expects a file-like object that works in text mode
        lines = StringIO(to_unicode(obj.body if isinstance(obj, Response) else obj, encoding))

        kwargs = {}
        if delimiter:
            kwargs["delimiter"] = delimiter
        if quotechar:
            kwargs["quotechar"] = quotechar

        csv_r = csv.reader(lines, **kwargs)

        if not headers:
            headers = _getrow(csv_r)

        while True:
>           row = _getrow(csv_r)

/testbed/scrapy/utils/iterators.py:139: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

csv_r = <_csv.reader object at 0x7fcb95edb1b0>

    def _getrow(csv_r):
>       return [to_unicode(field, encoding) for field in next(csv_r)]
E       StopIteration

/testbed/scrapy/utils/iterators.py:120: StopIteration

The above exception was the direct cause of the following exception:

self = 

    def test_csviter_delimiter_binary_response_assume_utf8_encoding(self):
        body = get_testdata("feeds", "feed-sample3.csv").replace(b",", b"\t")
        response = Response(url="http://example.com/", body=body)
        csv = csviter(response, delimiter="\t")

        self.assertEqual(
>           [row for row in csv],
            [
                {"id": "1", "name": "alpha", "value": "foobar"},
                {"id": "2", "name": "unicode", "value": "\xfan\xedc\xf3d\xe9\u203d"},
                {"id": "3", "name": "multi", "value": "foo\nbar"},
                {"id": "4", "name": "empty", "value": ""},
            ],
        )
E       RuntimeError: generator raised StopIteration

/testbed/tests/test_utils_iterators.py:444: RuntimeError

test_utils_iterators.py::UtilsCsvTestCase::test_csviter_encoding

test_utils_iterators.py::UtilsCsvTestCase::test_csviter_encoding
self = 

    def test_csviter_encoding(self):
        body1 = get_testdata("feeds", "feed-sample4.csv")
        body2 = get_testdata("feeds", "feed-sample5.csv")

        response = TextResponse(
            url="http://example.com/", body=body1, encoding="latin1"
        )
        csv = csviter(response)
        self.assertEqual(
>           list(csv),
            [
                {"id": "1", "name": "latin1", "value": "test"},
                {"id": "2", "name": "something", "value": "\xf1\xe1\xe9\xf3"},
            ],
        )

/testbed/tests/test_utils_iterators.py:508: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

obj = <200 http://example.com/>, delimiter = None, headers = None
encoding = None, quotechar = None

    def csviter(obj: Union[Response, str, bytes], delimiter: Optional[str]=None, headers: Optional[List[str]]=None, encoding: Optional[str]=None, quotechar: Optional[str]=None) -> Generator[Dict[str, str], Any, None]:
        """Returns an iterator of dictionaries from the given csv object

        obj can be:
        - a Response object
        - a unicode string
        - a string encoded as utf-8

        delimiter is the character used to separate fields on the given obj.

        headers is an iterable that when provided offers the keys
        for the returned dictionaries, if not the first row is used.

        quotechar is the character used to enclosure fields on the given obj.
        """
        def _getrow(csv_r):
            return [to_unicode(field, encoding) for field in next(csv_r)]

>       encoding = obj.encoding if isinstance(obj, TextResponse) else encoding or "utf-8"
E       AttributeError: 'TextResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/utils/iterators.py:122: AttributeError

test_utils_iterators.py::UtilsCsvTestCase::test_csviter_exception

test_utils_iterators.py::UtilsCsvTestCase::test_csviter_exception
self = 

    def test_csviter_exception(self):
        body = get_testdata("feeds", "feed-sample3.csv")

        response = TextResponse(url="http://example.com/", body=body)
        iter = csviter(response)
>       next(iter)

/testbed/tests/test_utils_iterators.py:492: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

obj = <200 http://example.com/>, delimiter = None, headers = None
encoding = None, quotechar = None

    def csviter(obj: Union[Response, str, bytes], delimiter: Optional[str]=None, headers: Optional[List[str]]=None, encoding: Optional[str]=None, quotechar: Optional[str]=None) -> Generator[Dict[str, str], Any, None]:
        """Returns an iterator of dictionaries from the given csv object

        obj can be:
        - a Response object
        - a unicode string
        - a string encoded as utf-8

        delimiter is the character used to separate fields on the given obj.

        headers is an iterable that when provided offers the keys
        for the returned dictionaries, if not the first row is used.

        quotechar is the character used to enclosure fields on the given obj.
        """
        def _getrow(csv_r):
            return [to_unicode(field, encoding) for field in next(csv_r)]

>       encoding = obj.encoding if isinstance(obj, TextResponse) else encoding or "utf-8"
E       AttributeError: 'TextResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/utils/iterators.py:122: AttributeError

test_utils_iterators.py::UtilsCsvTestCase::test_csviter_falserow

test_utils_iterators.py::UtilsCsvTestCase::test_csviter_falserow
self = 

    def test_csviter_falserow(self):
        body = get_testdata("feeds", "feed-sample3.csv")
        body = b"\n".join((body, b"a,b", b"a,b,c,d"))

        response = TextResponse(url="http://example.com/", body=body)
        csv = csviter(response)

        self.assertEqual(
>           [row for row in csv],
            [
                {"id": "1", "name": "alpha", "value": "foobar"},
                {"id": "2", "name": "unicode", "value": "\xfan\xedc\xf3d\xe9\u203d"},
                {"id": "3", "name": "multi", "value": "foo\nbar"},
                {"id": "4", "name": "empty", "value": ""},
            ],
        )

/testbed/tests/test_utils_iterators.py:478: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

obj = <200 http://example.com/>, delimiter = None, headers = None
encoding = None, quotechar = None

    def csviter(obj: Union[Response, str, bytes], delimiter: Optional[str]=None, headers: Optional[List[str]]=None, encoding: Optional[str]=None, quotechar: Optional[str]=None) -> Generator[Dict[str, str], Any, None]:
        """Returns an iterator of dictionaries from the given csv object

        obj can be:
        - a Response object
        - a unicode string
        - a string encoded as utf-8

        delimiter is the character used to separate fields on the given obj.

        headers is an iterable that when provided offers the keys
        for the returned dictionaries, if not the first row is used.

        quotechar is the character used to enclosure fields on the given obj.
        """
        def _getrow(csv_r):
            return [to_unicode(field, encoding) for field in next(csv_r)]

>       encoding = obj.encoding if isinstance(obj, TextResponse) else encoding or "utf-8"
E       AttributeError: 'TextResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/utils/iterators.py:122: AttributeError

test_utils_iterators.py::UtilsCsvTestCase::test_csviter_headers

test_utils_iterators.py::UtilsCsvTestCase::test_csviter_headers
self = 

    def test_csviter_headers(self):
        sample = get_testdata("feeds", "feed-sample3.csv").splitlines()
        headers, body = sample[0].split(b","), b"\n".join(sample[1:])

        response = TextResponse(url="http://example.com/", body=body)
        csv = csviter(response, headers=[h.decode("utf-8") for h in headers])

        self.assertEqual(
>           [row for row in csv],
            [
                {"id": "1", "name": "alpha", "value": "foobar"},
                {"id": "2", "name": "unicode", "value": "\xfan\xedc\xf3d\xe9\u203d"},
                {"id": "3", "name": "multi", "value": "foo\nbar"},
                {"id": "4", "name": "empty", "value": ""},
            ],
        )

/testbed/tests/test_utils_iterators.py:461: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

obj = <200 http://example.com/>, delimiter = None
headers = ['id', 'name', 'value'], encoding = None, quotechar = None

    def csviter(obj: Union[Response, str, bytes], delimiter: Optional[str]=None, headers: Optional[List[str]]=None, encoding: Optional[str]=None, quotechar: Optional[str]=None) -> Generator[Dict[str, str], Any, None]:
        """Returns an iterator of dictionaries from the given csv object

        obj can be:
        - a Response object
        - a unicode string
        - a string encoded as utf-8

        delimiter is the character used to separate fields on the given obj.

        headers is an iterable that when provided offers the keys
        for the returned dictionaries, if not the first row is used.

        quotechar is the character used to enclosure fields on the given obj.
        """
        def _getrow(csv_r):
            return [to_unicode(field, encoding) for field in next(csv_r)]

>       encoding = obj.encoding if isinstance(obj, TextResponse) else encoding or "utf-8"
E       AttributeError: 'TextResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/utils/iterators.py:122: AttributeError

test_utils_iterators.py::UtilsCsvTestCase::test_csviter_quotechar

test_utils_iterators.py::UtilsCsvTestCase::test_csviter_quotechar
self = 

    def test_csviter_quotechar(self):
        body1 = get_testdata("feeds", "feed-sample6.csv")
        body2 = get_testdata("feeds", "feed-sample6.csv").replace(b",", b"|")

        response1 = TextResponse(url="http://example.com/", body=body1)
        csv1 = csviter(response1, quotechar="'")

        self.assertEqual(
>           [row for row in csv1],
            [
                {"id": "1", "name": "alpha", "value": "foobar"},
                {"id": "2", "name": "unicode", "value": "\xfan\xedc\xf3d\xe9\u203d"},
                {"id": "3", "name": "multi", "value": "foo\nbar"},
                {"id": "4", "name": "empty", "value": ""},
            ],
        )

/testbed/tests/test_utils_iterators.py:397: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

obj = <200 http://example.com/>, delimiter = None, headers = None
encoding = None, quotechar = "'"

    def csviter(obj: Union[Response, str, bytes], delimiter: Optional[str]=None, headers: Optional[List[str]]=None, encoding: Optional[str]=None, quotechar: Optional[str]=None) -> Generator[Dict[str, str], Any, None]:
        """Returns an iterator of dictionaries from the given csv object

        obj can be:
        - a Response object
        - a unicode string
        - a string encoded as utf-8

        delimiter is the character used to separate fields on the given obj.

        headers is an iterable that when provided offers the keys
        for the returned dictionaries, if not the first row is used.

        quotechar is the character used to enclosure fields on the given obj.
        """
        def _getrow(csv_r):
            return [to_unicode(field, encoding) for field in next(csv_r)]

>       encoding = obj.encoding if isinstance(obj, TextResponse) else encoding or "utf-8"
E       AttributeError: 'TextResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/utils/iterators.py:122: AttributeError

test_utils_iterators.py::UtilsCsvTestCase::test_csviter_wrong_quotechar

test_utils_iterators.py::UtilsCsvTestCase::test_csviter_wrong_quotechar
self = 

    def test_csviter_wrong_quotechar(self):
        body = get_testdata("feeds", "feed-sample6.csv")
        response = TextResponse(url="http://example.com/", body=body)
        csv = csviter(response)

        self.assertEqual(
>           [row for row in csv],
            [
                {"'id'": "1", "'name'": "'alpha'", "'value'": "'foobar'"},
                {
                    "'id'": "2",
                    "'name'": "'unicode'",
                    "'value'": "'\xfan\xedc\xf3d\xe9\u203d'",
                },
                {"'id'": "'3'", "'name'": "'multi'", "'value'": "'foo"},
                {"'id'": "4", "'name'": "'empty'", "'value'": ""},
            ],
        )

/testbed/tests/test_utils_iterators.py:425: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

obj = <200 http://example.com/>, delimiter = None, headers = None
encoding = None, quotechar = None

    def csviter(obj: Union[Response, str, bytes], delimiter: Optional[str]=None, headers: Optional[List[str]]=None, encoding: Optional[str]=None, quotechar: Optional[str]=None) -> Generator[Dict[str, str], Any, None]:
        """Returns an iterator of dictionaries from the given csv object

        obj can be:
        - a Response object
        - a unicode string
        - a string encoded as utf-8

        delimiter is the character used to separate fields on the given obj.

        headers is an iterable that when provided offers the keys
        for the returned dictionaries, if not the first row is used.

        quotechar is the character used to enclosure fields on the given obj.
        """
        def _getrow(csv_r):
            return [to_unicode(field, encoding) for field in next(csv_r)]

>       encoding = obj.encoding if isinstance(obj, TextResponse) else encoding or "utf-8"
E       AttributeError: 'TextResponse' object has no attribute 'encoding'. Did you mean: '_encoding'?

/testbed/scrapy/utils/iterators.py:122: AttributeError

test_utils_iterators.py::TestHelper::test_body_or_str

test_utils_iterators.py::TestHelper::test_body_or_str
self = 

    def test_body_or_str(self):
        for obj in (self.bbody, self.ubody, self.txtresponse, self.response):
            r1 = _body_or_str(obj)
>           self._assert_type_and_value(r1, self.ubody, obj)

/testbed/tests/test_utils_iterators.py:539: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/tests/test_utils_iterators.py:548: in _assert_type_and_value
    self.assertTrue(
/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py:402: in assertTrue
    super().assertTrue(condition, msg)
E   twisted.trial.unittest.FailTest: False is not true : Got , expected  for b'utf8-body'

init.py::UtilsMiscTestCase::test_arg_to_iter

__init__.py::UtilsMiscTestCase::test_arg_to_iter
self = 

    def test_arg_to_iter(self):
        class TestItem(Item):
            name = Field()

        assert hasattr(arg_to_iter(None), "__iter__")
>       assert hasattr(arg_to_iter(100), "__iter__")
E       AssertionError

/testbed/tests/test_utils_misc/__init__.py:83: AssertionError

init.py::UtilsMiscTestCase::test_rel_has_nofollow

__init__.py::UtilsMiscTestCase::test_rel_has_nofollow
self = 

    def test_rel_has_nofollow(self):
        assert rel_has_nofollow("ugc nofollow") is True
>       assert rel_has_nofollow("ugc,nofollow") is True
E       AssertionError

/testbed/tests/test_utils_misc/__init__.py:170: AssertionError

init.py::UtilsMiscTestCase::test_set_environ

__init__.py::UtilsMiscTestCase::test_set_environ
self = 

    def test_set_environ(self):
        assert os.environ.get("some_test_environ") is None
        with set_environ(some_test_environ="test_value"):
>           assert os.environ.get("some_test_environ") == "test_value"
E           AssertionError

/testbed/tests/test_utils_misc/__init__.py:159: AssertionError

test_return_with_argument_inside_generator.py::UtilsMiscPy3TestCase::test_generators_return_none

test_return_with_argument_inside_generator.py::UtilsMiscPy3TestCase::test_generators_return_none
self = 

        def test_generators_return_none(self):
            def f2():
                yield 1
                return None

            def g2():
                yield 1
                return

            def h2():
                yield 1

            def i2():
                yield 1
                yield from generator_that_returns_stuff()

            def j2():
                yield 1

                def helper():
                    return 0

                yield helper()

            def k2():
                """
                docstring
                """
                url = """
    https://example.org
            """
                yield url
                return

            def l2():
                return

>           assert not is_generator_with_return_value(top_level_return_none)

/testbed/tests/test_utils_misc/test_return_with_argument_inside_generator.py:140: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

callable = 

    def is_generator_with_return_value(callable: Callable) -> bool:
        """
        Returns True if a callable is a generator function which includes a
        'return' statement with a value different than None, False otherwise
        """
        if not inspect.isgeneratorfunction(callable):
            return False

>       if callable in _generator_callbacks_cache:
E       NameError: name '_generator_callbacks_cache' is not defined

/testbed/scrapy/utils/misc.py:202: NameError

test_return_with_argument_inside_generator.py::UtilsMiscPy3TestCase::test_generators_return_none_with_decorator

test_return_with_argument_inside_generator.py::UtilsMiscPy3TestCase::test_generators_return_none_with_decorator
self = 

        def test_generators_return_none_with_decorator(self):
            def decorator(func):
                def inner_func():
                    func()

                return inner_func

            @decorator
            def f3():
                yield 1
                return None

            @decorator
            def g3():
                yield 1
                return

            @decorator
            def h3():
                yield 1

            @decorator
            def i3():
                yield 1
                yield from generator_that_returns_stuff()

            @decorator
            def j3():
                yield 1

                def helper():
                    return 0

                yield helper()

            @decorator
            def k3():
                """
                docstring
                """
                url = """
    https://example.org
            """
                yield url
                return

            @decorator
            def l3():
                return

>           assert not is_generator_with_return_value(top_level_return_none)

/testbed/tests/test_utils_misc/test_return_with_argument_inside_generator.py:224: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

callable = 

    def is_generator_with_return_value(callable: Callable) -> bool:
        """
        Returns True if a callable is a generator function which includes a
        'return' statement with a value different than None, False otherwise
        """
        if not inspect.isgeneratorfunction(callable):
            return False

>       if callable in _generator_callbacks_cache:
E       NameError: name '_generator_callbacks_cache' is not defined

/testbed/scrapy/utils/misc.py:202: NameError

test_return_with_argument_inside_generator.py::UtilsMiscPy3TestCase::test_generators_return_something

test_return_with_argument_inside_generator.py::UtilsMiscPy3TestCase::test_generators_return_something
self = 

        def test_generators_return_something(self):
            def f1():
                yield 1
                return 2

            def g1():
                yield 1
                return "asdf"

            def h1():
                yield 1

                def helper():
                    return 0

                yield helper()
                return 2

            def i1():
                """
                docstring
                """
                url = """
    https://example.org
            """
                yield url
                return 1

>           assert is_generator_with_return_value(top_level_return_something)

/testbed/tests/test_utils_misc/test_return_with_argument_inside_generator.py:73: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

callable = 

    def is_generator_with_return_value(callable: Callable) -> bool:
        """
        Returns True if a callable is a generator function which includes a
        'return' statement with a value different than None, False otherwise
        """
        if not inspect.isgeneratorfunction(callable):
            return False

>       if callable in _generator_callbacks_cache:
E       NameError: name '_generator_callbacks_cache' is not defined

/testbed/scrapy/utils/misc.py:202: NameError

test_return_with_argument_inside_generator.py::UtilsMiscPy3TestCase::test_indentation_error

test_return_with_argument_inside_generator.py::UtilsMiscPy3TestCase::test_indentation_error
self = 

    @mock.patch(
        "scrapy.utils.misc.is_generator_with_return_value", new=_indentation_error
    )
    def test_indentation_error(self):
        with warnings.catch_warnings(record=True) as w:
>           warn_on_generator_with_return_value(None, top_level_return_none)

/testbed/tests/test_utils_misc/test_return_with_argument_inside_generator.py:263: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/utils/misc.py:234: in warn_on_generator_with_return_value
    if is_generator_with_return_value(callable):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (,), kwargs = {}

    def _indentation_error(*args, **kwargs):
>       raise IndentationError()
E       IndentationError: 

/testbed/tests/test_utils_misc/test_return_with_argument_inside_generator.py:13: IndentationError

test_return_with_argument_inside_generator.py::UtilsMiscPy3TestCase::test_partial

test_return_with_argument_inside_generator.py::UtilsMiscPy3TestCase::test_partial
self = 

    def test_partial(self):
        def cb(arg1, arg2):
            yield {}

        partial_cb = partial(cb, arg1=42)
>       assert not is_generator_with_return_value(partial_cb)

/testbed/tests/test_utils_misc/test_return_with_argument_inside_generator.py:272: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

callable = functools.partial(.cb at 0x7fcb95ecef20>, arg1=42)

    def is_generator_with_return_value(callable: Callable) -> bool:
        """
        Returns True if a callable is a generator function which includes a
        'return' statement with a value different than None, False otherwise
        """
        if not inspect.isgeneratorfunction(callable):
            return False

>       if callable in _generator_callbacks_cache:
E       NameError: name '_generator_callbacks_cache' is not defined

/testbed/scrapy/utils/misc.py:202: NameError

test_utils_project.py::ProjectUtilsTest::test_data_path_inside_project

test_utils_project.py::ProjectUtilsTest::test_data_path_inside_project
self = 

    def test_data_path_inside_project(self):
        with inside_a_project() as proj_path:
            expected = Path(proj_path, ".scrapy", "somepath")
>           self.assertEqual(expected.resolve(), Path(data_path("somepath")).resolve())
E           AssertionError: PosixPath('/tmp/tmpbvkp1o1c/.scrapy/somepath') != PosixPath('/root/.scrapy/projects/tmpbvkp1o1c/somepath')

/testbed/tests/test_utils_project.py:37: AssertionError

test_utils_project.py::ProjectUtilsTest::test_data_path_outside_project

test_utils_project.py::ProjectUtilsTest::test_data_path_outside_project
self = 

    def test_data_path_outside_project(self):
>       self.assertEqual(str(Path(".scrapy", "somepath")), data_path("somepath"))
E       AssertionError: '.scrapy/somepath' != '/root/.scrapy/projects/default/somepath'
E       - .scrapy/somepath
E       + /root/.scrapy/projects/default/somepath

/testbed/tests/test_utils_project.py:30: AssertionError

test_utils_project.py::GetProjectSettingsTestCase::test_invalid_envvar

test_utils_project.py::GetProjectSettingsTestCase::test_invalid_envvar
self = 

    def test_invalid_envvar(self):
        envvars = {
            "SCRAPY_FOO": "bar",
        }
        with set_environ(**envvars):
>           settings = get_project_settings()

/testbed/tests/test_utils_project.py:60: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def get_project_settings():
        """Get project settings module from environment variable"""
        if ENVVAR not in os.environ:
            project = os.environ.get('SCRAPY_PROJECT', 'default')
            init_env(project)

        settings = Settings()
        settings_module_path = os.environ.get(ENVVAR)
        if settings_module_path:
            settings.setmodule(settings_module_path, priority='project')

        scrapy_cfg = closest_scrapy_cfg()
        if scrapy_cfg is not None:
            config = get_config()
>           for key, value in config.items('settings', default={}):
E           TypeError: RawConfigParser.items() got an unexpected keyword argument 'default'

/testbed/scrapy/utils/project.py:25: TypeError

test_utils_project.py::GetProjectSettingsTestCase::test_valid_and_invalid_envvars

test_utils_project.py::GetProjectSettingsTestCase::test_valid_and_invalid_envvars
self = 

    def test_valid_and_invalid_envvars(self):
        value = "tests.test_cmdline.settings"
        envvars = {
            "SCRAPY_FOO": "bar",
            "SCRAPY_SETTINGS_MODULE": value,
        }
        with set_environ(**envvars):
>           settings = get_project_settings()

/testbed/tests/test_utils_project.py:71: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def get_project_settings():
        """Get project settings module from environment variable"""
        if ENVVAR not in os.environ:
            project = os.environ.get('SCRAPY_PROJECT', 'default')
            init_env(project)

        settings = Settings()
        settings_module_path = os.environ.get(ENVVAR)
        if settings_module_path:
            settings.setmodule(settings_module_path, priority='project')

        scrapy_cfg = closest_scrapy_cfg()
        if scrapy_cfg is not None:
            config = get_config()
>           for key, value in config.items('settings', default={}):
E           TypeError: RawConfigParser.items() got an unexpected keyword argument 'default'

/testbed/scrapy/utils/project.py:25: TypeError

test_utils_project.py::GetProjectSettingsTestCase::test_valid_envvar

test_utils_project.py::GetProjectSettingsTestCase::test_valid_envvar
self = 

    def test_valid_envvar(self):
        value = "tests.test_cmdline.settings"
        envvars = {
            "SCRAPY_SETTINGS_MODULE": value,
        }
        with warnings.catch_warnings():
            warnings.simplefilter("error")
            with set_environ(**envvars):
>               settings = get_project_settings()

/testbed/tests/test_utils_project.py:51: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def get_project_settings():
        """Get project settings module from environment variable"""
        if ENVVAR not in os.environ:
            project = os.environ.get('SCRAPY_PROJECT', 'default')
            init_env(project)

        settings = Settings()
        settings_module_path = os.environ.get(ENVVAR)
        if settings_module_path:
            settings.setmodule(settings_module_path, priority='project')

        scrapy_cfg = closest_scrapy_cfg()
        if scrapy_cfg is not None:
            config = get_config()
>           for key, value in config.items('settings', default={}):
E           TypeError: RawConfigParser.items() got an unexpected keyword argument 'default'

/testbed/scrapy/utils/project.py:25: TypeError

test_utils_python.py::MutableChainTest::test_mutablechain

test_utils_python.py::MutableChainTest::test_mutablechain
self = 

    def test_mutablechain(self):
        m = MutableChain(range(2), [2, 3], (4, 5))
>       m.extend(range(6, 7))
E       AttributeError: 'MutableChain' object has no attribute 'extend'

/testbed/tests/test_utils_python.py:27: AttributeError

test_utils_python.py::UtilsPythonTestCase::test_equal_attributes

test_utils_python.py::UtilsPythonTestCase::test_equal_attributes
self = 

    def test_equal_attributes(self):
        class Obj:
            pass

        a = Obj()
        b = Obj()
        # no attributes given return False
>       self.assertFalse(equal_attributes(a, b, []))

/testbed/tests/test_utils_python.py:160: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py:389: in assertFalse
    super().assertFalse(condition, msg)
E   twisted.trial.unittest.FailTest: True is not false

test_utils_python.py::UtilsPythonTestCase::test_get_func_args

test_utils_python.py::UtilsPythonTestCase::test_get_func_args
self = 

    def test_get_func_args(self):
        def f1(a, b, c):
            pass

        def f2(a, b=None, c=None):
            pass

        def f3(a, b=None, *, c=None):
            pass

        class A:
            def __init__(self, a, b, c):
                pass

            def method(self, a, b, c):
                pass

        class Callable:
            def __call__(self, a, b, c):
                pass

        a = A(1, 2, 3)
        cal = Callable()
        partial_f1 = functools.partial(f1, None)
        partial_f2 = functools.partial(f1, b=None)
        partial_f3 = functools.partial(partial_f2, None)

        self.assertEqual(get_func_args(f1), ["a", "b", "c"])
>       self.assertEqual(get_func_args(f2), ["a", "b", "c"])

/testbed/tests/test_utils_python.py:229: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py:444: in assertEqual
    super().assertEqual(first, second, msg)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
msg = "Lists differ: ['a'] != ['a', 'b', 'c']\n\nSecond list contains 2 additional elements.\nFirst extra element 1:\n'b'\n\n- ['a']\n+ ['a', 'b', 'c']"

    def fail(self, msg: Optional[object] = None) -> NoReturn:
        """
        Absolutely fail the test.  Do not pass go, do not collect $200.

        @param msg: the message that will be displayed as the reason for the
        failure
        """
>       raise self.failureException(msg)
E       twisted.trial.unittest.FailTest: Lists differ: ['a'] != ['a', 'b', 'c']
E       
E       Second list contains 2 additional elements.
E       First extra element 1:
E       'b'
E       
E       - ['a']
E       + ['a', 'b', 'c']

/testbed/.venv/lib/python3.12/site-packages/twisted/trial/_synctest.py:381: FailTest

test_utils_response.py::ResponseUtilsTest::test_get_base_url

test_utils_response.py::ResponseUtilsTest::test_get_base_url
self = 

    def test_get_base_url(self):
        resp = HtmlResponse(
            "http://www.example.com",
            body=b"""
        
        
        blahablsdfsal&
        """,
        )
>       self.assertEqual(get_base_url(resp), "http://www.example.com/img/")

/testbed/tests/test_utils_response.py:117: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <200 http://www.example.com>

    def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
        """Return the base url of the given response, joined with the response url"""
        if response not in _baseurl_cache:
>           text = response.text[0:4096]
E           TypeError: 'NoneType' object is not subscriptable

/testbed/scrapy/utils/response.py:26: TypeError

test_utils_response.py::ResponseUtilsTest::test_get_meta_refresh

test_utils_response.py::ResponseUtilsTest::test_get_meta_refresh
self = 

    def test_get_meta_refresh(self):
        r1 = HtmlResponse(
            "http://www.example.com",
            body=b"""
        
        Dummy
        blahablsdfsal&
        """,
        )
        r2 = HtmlResponse(
            "http://www.example.com",
            body=b"""
        
        Dummy
        blahablsdfsal&
        """,
        )
        r3 = HtmlResponse(
            "http://www.example.com",
            body=b"""
    

test_utils_response.py::ResponseUtilsTest::test_open_in_browser_redos_head

test_utils_response.py::ResponseUtilsTest::test_open_in_browser_redos_head
self = 

    def test_open_in_browser_redos_head(self):
        MAX_CPU_TIME = 0.02

        # Exploit input from
        # https://makenowjust-labs.github.io/recheck/playground/
        # for /(|\s.*?>))/ (old pattern to find the head element).
        body = b"       self.assertLess(end_time - start_time, MAX_CPU_TIME)
E       AssertionError: 0.240000000000002 not less than 0.02

/testbed/tests/test_utils_response.py:238: AssertionError

test_utils_response.py::ResponseUtilsTest::test_response_httprepr

test_utils_response.py::ResponseUtilsTest::test_response_httprepr
self = 

    def test_response_httprepr(self):
        with warnings.catch_warnings():
            warnings.simplefilter("ignore", ScrapyDeprecationWarning)

            r1 = Response("http://www.example.com")
>           self.assertEqual(response_httprepr(r1), b"HTTP/1.1 200 OK\r\n\r\n")
E           TypeError: 'NoneType' object is not callable

/testbed/tests/test_utils_response.py:32: TypeError

test_utils_response.py::test_remove_html_comments[a<!---a]

test_utils_response.py::test_remove_html_comments[a<!---a]
input_body = b'a<!--', output_body = b'a'

@pytest.mark.parametrize(
    "input_body,output_body",
    (
        (
            b"a<!--",
            b"a",
        ),
        (
            b"a<!---->b",
            b"ab",
        ),
        (
            b"a<!--b-->c",
            b"ac",
        ),
        (
            b"a<!--b-->c<!--",
            b"ac",
        ),
        (
            b"a<!--b-->c<!--d",
            b"ac",
        ),
        (
            b"a<!--b-->c<!---->d",
            b"acd",
        ),
        (
            b"a<!--b--><!--c-->d",
            b"ad",
        ),
    ),
)
def test_remove_html_comments(input_body, output_body):
    assert (
      _remove_html_comments(input_body) == output_body
    ), f"{_remove_html_comments(input_body)=} == {output_body=}"

/testbed/tests/test_utils_response.py:276:


/testbed/scrapy/utils/response.py:21: in _remove_html_comments return re.sub('', '', text, flags=re.DOTALL)


pattern = '', repl = '', string = b'a<!--', count = 0 flags = re.DOTALL

def sub(pattern, repl, string, count=0, flags=0):
    """Return the string obtained by replacing the leftmost
    non-overlapping occurrences of the pattern in string by the
    replacement repl.  repl can be either a string or a callable;
    if a string, backslash escapes in it are processed.  If it is
    a callable, it's passed the Match object and must return
    a replacement string to be used."""
  return _compile(pattern, flags).sub(repl, string, count)

E TypeError: cannot use a string pattern on a bytes-like object

/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/re/init.py:186: TypeError

test_utils_response.py::test_remove_html_comments[ab-ab]

test_utils_response.py::test_remove_html_comments[ab-ab]
input_body = b'ab', output_body = b'ab'

    @pytest.mark.parametrize(
        "input_body,output_body",
        (
            (
                b"ab",
                b"ab",
            ),
            (
                b"ac",
                b"ac",
            ),
            (
                b"acccd",
                b"acd",
            ),
            (
                b"ad",
                b"ad",
            ),
        ),
    )
    def test_remove_html_comments(input_body, output_body):
        assert (
>           _remove_html_comments(input_body) == output_body
        ), f"{_remove_html_comments(input_body)=} == {output_body=}"

/testbed/tests/test_utils_response.py:276: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/utils/response.py:21: in _remove_html_comments
    return re.sub('', '', text, flags=re.DOTALL)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

pattern = '', repl = '', string = b'ab', count = 0
flags = re.DOTALL

    def sub(pattern, repl, string, count=0, flags=0):
        """Return the string obtained by replacing the leftmost
        non-overlapping occurrences of the pattern in string by the
        replacement repl.  repl can be either a string or a callable;
        if a string, backslash escapes in it are processed.  If it is
        a callable, it's passed the Match object and must return
        a replacement string to be used."""
>       return _compile(pattern, flags).sub(repl, string, count)
E       TypeError: cannot use a string pattern on a bytes-like object

/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/re/__init__.py:186: TypeError

test_utils_response.py::test_remove_html_comments[ac-ac]

test_utils_response.py::test_remove_html_comments[ac-ac]
input_body = b'ac', output_body = b'ac'

    @pytest.mark.parametrize(
        "input_body,output_body",
        (
            (
                b"ab",
                b"ab",
            ),
            (
                b"ac",
                b"ac",
            ),
            (
                b"acccd",
                b"acd",
            ),
            (
                b"ad",
                b"ad",
            ),
        ),
    )
    def test_remove_html_comments(input_body, output_body):
        assert (
>           _remove_html_comments(input_body) == output_body
        ), f"{_remove_html_comments(input_body)=} == {output_body=}"

/testbed/tests/test_utils_response.py:276: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/utils/response.py:21: in _remove_html_comments
    return re.sub('', '', text, flags=re.DOTALL)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

pattern = '', repl = '', string = b'ac', count = 0
flags = re.DOTALL

    def sub(pattern, repl, string, count=0, flags=0):
        """Return the string obtained by replacing the leftmost
        non-overlapping occurrences of the pattern in string by the
        replacement repl.  repl can be either a string or a callable;
        if a string, backslash escapes in it are processed.  If it is
        a callable, it's passed the Match object and must return
        a replacement string to be used."""
>       return _compile(pattern, flags).sub(repl, string, count)
E       TypeError: cannot use a string pattern on a bytes-like object

/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/re/__init__.py:186: TypeError

test_utils_response.py::test_remove_html_comments[ac<!---ac]

test_utils_response.py::test_remove_html_comments[ac<!---ac]
input_body = b'ac<!--', output_body = b'ac'

@pytest.mark.parametrize(
    "input_body,output_body",
    (
        (
            b"a<!--",
            b"a",
        ),
        (
            b"a<!---->b",
            b"ab",
        ),
        (
            b"a<!--b-->c",
            b"ac",
        ),
        (
            b"a<!--b-->c<!--",
            b"ac",
        ),
        (
            b"a<!--b-->c<!--d",
            b"ac",
        ),
        (
            b"a<!--b-->c<!---->d",
            b"acd",
        ),
        (
            b"a<!--b--><!--c-->d",
            b"ad",
        ),
    ),
)
def test_remove_html_comments(input_body, output_body):
    assert (
      _remove_html_comments(input_body) == output_body
    ), f"{_remove_html_comments(input_body)=} == {output_body=}"

/testbed/tests/test_utils_response.py:276:


/testbed/scrapy/utils/response.py:21: in _remove_html_comments return re.sub('', '', text, flags=re.DOTALL)


pattern = '', repl = '', string = b'ac<!--', count = 0 flags = re.DOTALL

def sub(pattern, repl, string, count=0, flags=0):
    """Return the string obtained by replacing the leftmost
    non-overlapping occurrences of the pattern in string by the
    replacement repl.  repl can be either a string or a callable;
    if a string, backslash escapes in it are processed.  If it is
    a callable, it's passed the Match object and must return
    a replacement string to be used."""
  return _compile(pattern, flags).sub(repl, string, count)

E TypeError: cannot use a string pattern on a bytes-like object

/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/re/init.py:186: TypeError

test_utils_response.py::test_remove_html_comments[ac<!--d-ac]

test_utils_response.py::test_remove_html_comments[ac<!--d-ac]
input_body = b'ac<!--d', output_body = b'ac'

@pytest.mark.parametrize(
    "input_body,output_body",
    (
        (
            b"a<!--",
            b"a",
        ),
        (
            b"a<!---->b",
            b"ab",
        ),
        (
            b"a<!--b-->c",
            b"ac",
        ),
        (
            b"a<!--b-->c<!--",
            b"ac",
        ),
        (
            b"a<!--b-->c<!--d",
            b"ac",
        ),
        (
            b"a<!--b-->c<!---->d",
            b"acd",
        ),
        (
            b"a<!--b--><!--c-->d",
            b"ad",
        ),
    ),
)
def test_remove_html_comments(input_body, output_body):
    assert (
      _remove_html_comments(input_body) == output_body
    ), f"{_remove_html_comments(input_body)=} == {output_body=}"

/testbed/tests/test_utils_response.py:276:


/testbed/scrapy/utils/response.py:21: in _remove_html_comments return re.sub('', '', text, flags=re.DOTALL)


pattern = '', repl = '', string = b'ac<!--d', count = 0 flags = re.DOTALL

def sub(pattern, repl, string, count=0, flags=0):
    """Return the string obtained by replacing the leftmost
    non-overlapping occurrences of the pattern in string by the
    replacement repl.  repl can be either a string or a callable;
    if a string, backslash escapes in it are processed.  If it is
    a callable, it's passed the Match object and must return
    a replacement string to be used."""
  return _compile(pattern, flags).sub(repl, string, count)

E TypeError: cannot use a string pattern on a bytes-like object

/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/re/init.py:186: TypeError

test_utils_response.py::test_remove_html_comments[acd-acd]

test_utils_response.py::test_remove_html_comments[acd-acd]
input_body = b'acd', output_body = b'acd'

    @pytest.mark.parametrize(
        "input_body,output_body",
        (
            (
                b"ab",
                b"ab",
            ),
            (
                b"ac",
                b"ac",
            ),
            (
                b"acccd",
                b"acd",
            ),
            (
                b"ad",
                b"ad",
            ),
        ),
    )
    def test_remove_html_comments(input_body, output_body):
        assert (
>           _remove_html_comments(input_body) == output_body
        ), f"{_remove_html_comments(input_body)=} == {output_body=}"

/testbed/tests/test_utils_response.py:276: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/utils/response.py:21: in _remove_html_comments
    return re.sub('', '', text, flags=re.DOTALL)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

pattern = '', repl = '', string = b'acd', count = 0
flags = re.DOTALL

    def sub(pattern, repl, string, count=0, flags=0):
        """Return the string obtained by replacing the leftmost
        non-overlapping occurrences of the pattern in string by the
        replacement repl.  repl can be either a string or a callable;
        if a string, backslash escapes in it are processed.  If it is
        a callable, it's passed the Match object and must return
        a replacement string to be used."""
>       return _compile(pattern, flags).sub(repl, string, count)
E       TypeError: cannot use a string pattern on a bytes-like object

/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/re/__init__.py:186: TypeError

test_utils_response.py::test_remove_html_comments[ad-ad]

test_utils_response.py::test_remove_html_comments[ad-ad]
input_body = b'ad', output_body = b'ad'

    @pytest.mark.parametrize(
        "input_body,output_body",
        (
            (
                b"ab",
                b"ab",
            ),
            (
                b"ac",
                b"ac",
            ),
            (
                b"acccd",
                b"acd",
            ),
            (
                b"ad",
                b"ad",
            ),
        ),
    )
    def test_remove_html_comments(input_body, output_body):
        assert (
>           _remove_html_comments(input_body) == output_body
        ), f"{_remove_html_comments(input_body)=} == {output_body=}"

/testbed/tests/test_utils_response.py:276: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/utils/response.py:21: in _remove_html_comments
    return re.sub('', '', text, flags=re.DOTALL)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

pattern = '', repl = '', string = b'ad', count = 0
flags = re.DOTALL

    def sub(pattern, repl, string, count=0, flags=0):
        """Return the string obtained by replacing the leftmost
        non-overlapping occurrences of the pattern in string by the
        replacement repl.  repl can be either a string or a callable;
        if a string, backslash escapes in it are processed.  If it is
        a callable, it's passed the Match object and must return
        a replacement string to be used."""
>       return _compile(pattern, flags).sub(repl, string, count)
E       TypeError: cannot use a string pattern on a bytes-like object

/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/re/__init__.py:186: TypeError

test_utils_serialize.py::JsonEncoderTestCase::test_encode_attrs_item

test_utils_serialize.py::JsonEncoderTestCase::test_encode_attrs_item
self = 

    def test_encode_attrs_item(self):
        @attr.s
        class AttrsItem:
            name = attr.ib(type=str)
            url = attr.ib(type=str)
            price = attr.ib(type=int)

        item = AttrsItem(name="Product", url="http://product.org", price=1)
>       encoded = self.encoder.encode(item)

/testbed/tests/test_utils_serialize.py:82: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/json/encoder.py:200: in encode
    chunks = self.iterencode(o, _one_shot=True)
/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/json/encoder.py:258: in iterencode
    return _iterencode(o, 0)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
o = AttrsItem(name='Product', url='http://product.org', price=1)

    def default(self, o):
        """Implement this method in a subclass such that it returns
        a serializable object for ``o``, or calls the base implementation
        (to raise a ``TypeError``).

        For example, to support arbitrary iterators, you could
        implement default like this::

            def default(self, o):
                try:
                    iterable = iter(o)
                except TypeError:
                    pass
                else:
                    return list(iterable)
                # Let the base class default method raise the TypeError
                return super().default(o)

        """
>       raise TypeError(f'Object of type {o.__class__.__name__} '
                        f'is not JSON serializable')
E       TypeError: Object of type AttrsItem is not JSON serializable

/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/json/encoder.py:180: TypeError

test_utils_serialize.py::JsonEncoderTestCase::test_encode_dataclass_item

test_utils_serialize.py::JsonEncoderTestCase::test_encode_dataclass_item
self = 

    def test_encode_dataclass_item(self):
        @dataclasses.dataclass
        class TestDataClass:
            name: str
            url: str
            price: int

        item = TestDataClass(name="Product", url="http://product.org", price=1)
>       encoded = self.encoder.encode(item)

/testbed/tests/test_utils_serialize.py:69: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/json/encoder.py:200: in encode
    chunks = self.iterencode(o, _one_shot=True)
/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/json/encoder.py:258: in iterencode
    return _iterencode(o, 0)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
o = JsonEncoderTestCase.test_encode_dataclass_item..TestDataClass(name='Product', url='http://product.org', price=1)

    def default(self, o):
        """Implement this method in a subclass such that it returns
        a serializable object for ``o``, or calls the base implementation
        (to raise a ``TypeError``).

        For example, to support arbitrary iterators, you could
        implement default like this::

            def default(self, o):
                try:
                    iterable = iter(o)
                except TypeError:
                    pass
                else:
                    return list(iterable)
                # Let the base class default method raise the TypeError
                return super().default(o)

        """
>       raise TypeError(f'Object of type {o.__class__.__name__} '
                        f'is not JSON serializable')
E       TypeError: Object of type TestDataClass is not JSON serializable

/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/json/encoder.py:180: TypeError

test_utils_serialize.py::JsonEncoderTestCase::test_encode_decode

test_utils_serialize.py::JsonEncoderTestCase::test_encode_decode
self = 

    def test_encode_decode(self):
        dt = datetime.datetime(2010, 1, 2, 10, 11, 12)
        dts = "2010-01-02 10:11:12"
        d = datetime.date(2010, 1, 2)
        ds = "2010-01-02"
        t = datetime.time(10, 11, 12)
        ts = "10:11:12"
        dec = Decimal("1000.12")
        decs = "1000.12"
        s = {"foo"}
        ss = ["foo"]
        dt_set = {dt}
        dt_sets = [dts]

        for input, output in [
            ("foo", "foo"),
            (d, ds),
            (t, ts),
            (dt, dts),
            (dec, decs),
            (["foo", d], ["foo", ds]),
            (s, ss),
            (dt_set, dt_sets),
        ]:
            self.assertEqual(
>               self.encoder.encode(input), json.dumps(output, sort_keys=True)
            )

/testbed/tests/test_utils_serialize.py:43: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/json/encoder.py:200: in encode
    chunks = self.iterencode(o, _one_shot=True)
/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/json/encoder.py:258: in iterencode
    return _iterencode(o, 0)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
o = datetime.date(2010, 1, 2)

    def default(self, o):
        """Implement this method in a subclass such that it returns
        a serializable object for ``o``, or calls the base implementation
        (to raise a ``TypeError``).

        For example, to support arbitrary iterators, you could
        implement default like this::

            def default(self, o):
                try:
                    iterable = iter(o)
                except TypeError:
                    pass
                else:
                    return list(iterable)
                # Let the base class default method raise the TypeError
                return super().default(o)

        """
>       raise TypeError(f'Object of type {o.__class__.__name__} '
                        f'is not JSON serializable')
E       TypeError: Object of type date is not JSON serializable

/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/json/encoder.py:180: TypeError

test_utils_serialize.py::JsonEncoderTestCase::test_encode_deferred

test_utils_serialize.py::JsonEncoderTestCase::test_encode_deferred
self = 

    def test_encode_deferred(self):
>       self.assertIn("Deferred", self.encoder.encode(defer.Deferred()))

/testbed/tests/test_utils_serialize.py:47: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/json/encoder.py:200: in encode
    chunks = self.iterencode(o, _one_shot=True)
/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/json/encoder.py:258: in iterencode
    return _iterencode(o, 0)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
o = 

    def default(self, o):
        """Implement this method in a subclass such that it returns
        a serializable object for ``o``, or calls the base implementation
        (to raise a ``TypeError``).

        For example, to support arbitrary iterators, you could
        implement default like this::

            def default(self, o):
                try:
                    iterable = iter(o)
                except TypeError:
                    pass
                else:
                    return list(iterable)
                # Let the base class default method raise the TypeError
                return super().default(o)

        """
>       raise TypeError(f'Object of type {o.__class__.__name__} '
                        f'is not JSON serializable')
E       TypeError: Object of type Deferred is not JSON serializable

/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/json/encoder.py:180: TypeError

test_utils_serialize.py::JsonEncoderTestCase::test_encode_request

test_utils_serialize.py::JsonEncoderTestCase::test_encode_request
self = 

    def test_encode_request(self):
        r = Request("http://www.example.com/lala")
>       rs = self.encoder.encode(r)

/testbed/tests/test_utils_serialize.py:51: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/json/encoder.py:200: in encode
    chunks = self.iterencode(o, _one_shot=True)
/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/json/encoder.py:258: in iterencode
    return _iterencode(o, 0)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
o = 

    def default(self, o):
        """Implement this method in a subclass such that it returns
        a serializable object for ``o``, or calls the base implementation
        (to raise a ``TypeError``).

        For example, to support arbitrary iterators, you could
        implement default like this::

            def default(self, o):
                try:
                    iterable = iter(o)
                except TypeError:
                    pass
                else:
                    return list(iterable)
                # Let the base class default method raise the TypeError
                return super().default(o)

        """
>       raise TypeError(f'Object of type {o.__class__.__name__} '
                        f'is not JSON serializable')
E       TypeError: Object of type Request is not JSON serializable

/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/json/encoder.py:180: TypeError

test_utils_serialize.py::JsonEncoderTestCase::test_encode_response

test_utils_serialize.py::JsonEncoderTestCase::test_encode_response
self = 

    def test_encode_response(self):
        r = Response("http://www.example.com/lala")
>       rs = self.encoder.encode(r)

/testbed/tests/test_utils_serialize.py:57: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/json/encoder.py:200: in encode
    chunks = self.iterencode(o, _one_shot=True)
/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/json/encoder.py:258: in iterencode
    return _iterencode(o, 0)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
o = <200 http://www.example.com/lala>

    def default(self, o):
        """Implement this method in a subclass such that it returns
        a serializable object for ``o``, or calls the base implementation
        (to raise a ``TypeError``).

        For example, to support arbitrary iterators, you could
        implement default like this::

            def default(self, o):
                try:
                    iterable = iter(o)
                except TypeError:
                    pass
                else:
                    return list(iterable)
                # Let the base class default method raise the TypeError
                return super().default(o)

        """
>       raise TypeError(f'Object of type {o.__class__.__name__} '
                        f'is not JSON serializable')
E       TypeError: Object of type Response is not JSON serializable

/root/.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/json/encoder.py:180: TypeError

test_utils_sitemap.py::SitemapTest::test_sitemap_urls_from_robots

test_utils_sitemap.py::SitemapTest::test_sitemap_urls_from_robots
self = 

        def test_sitemap_urls_from_robots(self):
            robots = """User-agent: *
    Disallow: /aff/
    Disallow: /wl/

    # Search and shopping refining
    Disallow: /s*/*facet
    Disallow: /s*/*tags

    # Sitemap files
    Sitemap: http://example.com/sitemap.xml
    Sitemap: http://example.com/sitemap-product-index.xml
    Sitemap: HTTP://example.com/sitemap-uppercase.xml
    Sitemap: /sitemap-relative-url.xml

    # Forums
    Disallow: /forum/search/
    Disallow: /forum/active/
    """
            self.assertEqual(
>               list(sitemap_urls_from_robots(robots, base_url="http://example.com")),
                [
                    "http://example.com/sitemap.xml",
                    "http://example.com/sitemap-product-index.xml",
                    "http://example.com/sitemap-uppercase.xml",
                    "http://example.com/sitemap-relative-url.xml",
                ],
            )
E           TypeError: 'NoneType' object is not iterable

/testbed/tests/test_utils_sitemap.py:191: TypeError

test_utils_spider.py::UtilsSpidersTestCase::test_iterate_spider_output

test_utils_spider.py::UtilsSpidersTestCase::test_iterate_spider_output
self = 

    def test_iterate_spider_output(self):
        i = Item()
        r = Request("http://scrapytest.org")
        o = object()

        self.assertEqual(list(iterate_spider_output(i)), [i])
>       self.assertEqual(list(iterate_spider_output(r)), [r])
E       TypeError: 'Request' object is not iterable

/testbed/tests/test_utils_spider.py:24: TypeError

test_utils_template.py::UtilsRenderTemplateFileTestCase::test_simple_render

test_utils_template.py::UtilsRenderTemplateFileTestCase::test_simple_render
self = 

    def test_simple_render(self):
        context = dict(project_name="proj", name="spi", classname="TheSpider")
        template = "from ${project_name}.spiders.${name} import ${classname}"
        rendered = "from proj.spiders.spi import TheSpider"

        template_path = Path(self.tmp_path, "templ.py.tmpl")
        render_path = Path(self.tmp_path, "templ.py")

        template_path.write_text(template, encoding="utf8")
        assert template_path.is_file()  # Failure of test itself

        render_templatefile(template_path, **context)

>       self.assertFalse(template_path.exists())
E       AssertionError: True is not false

/testbed/tests/test_utils_template.py:31: AssertionError

test_utils_trackref.py::TrackrefTestCase::test_format_live_refs

test_utils_trackref.py::TrackrefTestCase::test_format_live_refs
self = 

        def test_format_live_refs(self):
            o1 = Foo()  # NOQA
            o2 = Bar()  # NOQA
            o3 = Foo()  # NOQA
>           self.assertEqual(
                trackref.format_live_refs(),
                """\
    Live References

    Bar                                 1   oldest: 0s ago
    Foo                                 2   oldest: 0s ago
    """,
            )
E           AssertionError: None != 'Live References\n\nBar                  [87 chars]go\n'

/testbed/tests/test_utils_trackref.py:27: AssertionError

test_utils_trackref.py::TrackrefTestCase::test_get_oldest

test_utils_trackref.py::TrackrefTestCase::test_get_oldest
self = 

    def test_get_oldest(self):
        o1 = Foo()  # NOQA

        o1_time = time()

        o2 = Bar()  # NOQA

        o3_time = time()
        if o3_time <= o1_time:
            sleep(0.01)
            o3_time = time()
        if o3_time <= o1_time:
            raise SkipTest("time.time is not precise enough")

        o3 = Foo()  # NOQA
>       self.assertIs(trackref.get_oldest("Foo"), o1)
E       AssertionError: None is not 

/testbed/tests/test_utils_trackref.py:78: AssertionError

test_utils_trackref.py::TrackrefTestCase::test_iter_all

test_utils_trackref.py::TrackrefTestCase::test_iter_all
self = 

    def test_iter_all(self):
        o1 = Foo()  # NOQA
        o2 = Bar()  # NOQA
        o3 = Foo()  # NOQA
        self.assertEqual(
>           set(trackref.iter_all("Foo")),
            {o1, o3},
        )
E       TypeError: 'NoneType' object is not iterable

/testbed/tests/test_utils_trackref.py:87: TypeError

test_utils_trackref.py::TrackrefTestCase::test_print_live_refs_empty

test_utils_trackref.py::TrackrefTestCase::test_print_live_refs_empty
self = 
stdout = <_io.StringIO object at 0x7fcb97213dc0>

    @mock.patch("sys.stdout", new_callable=StringIO)
    def test_print_live_refs_empty(self, stdout):
        trackref.print_live_refs()
>       self.assertEqual(stdout.getvalue(), "Live References\n\n\n")
E       AssertionError: '' != 'Live References\n\n\n'
E       + Live References
E       + 
E       +

/testbed/tests/test_utils_trackref.py:49: AssertionError

test_utils_trackref.py::TrackrefTestCase::test_print_live_refs_with_objects

test_utils_trackref.py::TrackrefTestCase::test_print_live_refs_with_objects
self = 
stdout = <_io.StringIO object at 0x7fcb975d04c0>

        @mock.patch("sys.stdout", new_callable=StringIO)
        def test_print_live_refs_with_objects(self, stdout):
            o1 = Foo()  # NOQA
            trackref.print_live_refs()
>           self.assertEqual(
                stdout.getvalue(),
                """\
    Live References

    Foo                                 1   oldest: 0s ago\n\n""",
            )
E           AssertionError: '' != 'Live References\n\nFoo                                 1   oldest: 0s ago\n\n'
E           + Live References
E           + 
E           + Foo                                 1   oldest: 0s ago
E           +

/testbed/tests/test_utils_trackref.py:55: AssertionError

test_utils_url.py::UrlUtilsTest::test_url_has_any_extension

test_utils_url.py::UrlUtilsTest::test_url_has_any_extension
self = 

    def test_url_has_any_extension(self):
        deny_extensions = {"." + e for e in arg_to_iter(IGNORED_EXTENSIONS)}
        self.assertTrue(
>           url_has_any_extension(
                "http://www.example.com/archive.tar.gz", deny_extensions
            )
        )

/testbed/tests/test_utils_url.py:140: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/testbed/scrapy/utils/url.py:44: in url_has_any_extension
    return any(path.endswith('.' + ext) for ext in extensions)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

.0 = 

>   return any(path.endswith('.' + ext) for ext in extensions)
E   TypeError: endswith first arg must be bytes or a tuple of bytes, not str

/testbed/scrapy/utils/url.py:44: TypeError

test_utils_url.py::UrlUtilsTest::test_url_is_from_any_domain

test_utils_url.py::UrlUtilsTest::test_url_is_from_any_domain
self = 

    def test_url_is_from_any_domain(self):
        url = "http://www.wheele-bin-art.co.uk/get/product/123"
        self.assertTrue(url_is_from_any_domain(url, ["wheele-bin-art.co.uk"]))
>       self.assertFalse(url_is_from_any_domain(url, ["art.co.uk"]))
E       AssertionError: True is not false

/testbed/tests/test_utils_url.py:23: AssertionError

test_utils_url.py::UrlUtilsTest::test_url_is_from_spider

test_utils_url.py::UrlUtilsTest::test_url_is_from_spider
self = 

    def test_url_is_from_spider(self):
        spider = Spider(name="example.com")
>       self.assertTrue(
            url_is_from_spider("http://www.example.com/some/page.html", spider)
        )
E       AssertionError: False is not true

/testbed/tests/test_utils_url.py:48: AssertionError

test_utils_url.py::UrlUtilsTest::test_url_is_from_spider_class_attributes

test_utils_url.py::UrlUtilsTest::test_url_is_from_spider_class_attributes
self = 

    def test_url_is_from_spider_class_attributes(self):
        class MySpider(Spider):
            name = "example.com"

>       self.assertTrue(
            url_is_from_spider("http://www.example.com/some/page.html", MySpider)
        )
E       AssertionError: False is not true

/testbed/tests/test_utils_url.py:65: AssertionError

test_utils_url.py::UrlUtilsTest::test_url_is_from_spider_with_allowed_domains

test_utils_url.py::UrlUtilsTest::test_url_is_from_spider_with_allowed_domains
self = 

    def test_url_is_from_spider_with_allowed_domains(self):
        spider = Spider(
            name="example.com", allowed_domains=["example.org", "example.net"]
        )
>       self.assertTrue(
            url_is_from_spider("http://www.example.com/some/page.html", spider)
        )
E       AssertionError: False is not true

/testbed/tests/test_utils_url.py:82: AssertionError

test_utils_url.py::UrlUtilsTest::test_url_is_from_spider_with_allowed_domains_class_attributes

test_utils_url.py::UrlUtilsTest::test_url_is_from_spider_with_allowed_domains_class_attributes
self = 

    def test_url_is_from_spider_with_allowed_domains_class_attributes(self):
        class MySpider(Spider):
            name = "example.com"
            allowed_domains = ("example.org", "example.net")

>       self.assertTrue(
            url_is_from_spider("http://www.example.com/some/page.html", MySpider)
        )
E       AssertionError: False is not true

/testbed/tests/test_utils_url.py:118: AssertionError

test_utils_url.py::AddHttpIfNoScheme::test_protocol_relative

test_utils_url.py::AddHttpIfNoScheme::test_protocol_relative
self = 

    def test_protocol_relative(self):
>       self.assertEqual(
            add_http_if_no_scheme("//www.example.com"), "http://www.example.com"
        )
E       AssertionError: 'http:////www.example.com' != 'http://www.example.com'
E       - http:////www.example.com
E       ?      --
E       + http://www.example.com

/testbed/tests/test_utils_url.py:258: AssertionError

test_utils_url.py::AddHttpIfNoScheme::test_protocol_relative_complete_url

test_utils_url.py::AddHttpIfNoScheme::test_protocol_relative_complete_url
self = 

    def test_protocol_relative_complete_url(self):
>       self.assertEqual(
            add_http_if_no_scheme(
                "//username:password@www.example.com:80/some/page/do?a=1&b=2&c=3#frag"
            ),
            "http://username:password@www.example.com:80/some/page/do?a=1&b=2&c=3#frag",
        )
E       AssertionError: 'http:////username:password@www.example.com:80/some/page/do?a=1&b=2&c=3#frag' != 'http://username:password@www.example.com:80/some/page/do?a=1&b=2&c=3#frag'
E       - http:////username:password@www.example.com:80/some/page/do?a=1&b=2&c=3#frag
E       ?      --
E       + http://username:password@www.example.com:80/some/page/do?a=1&b=2&c=3#frag

/testbed/tests/test_utils_url.py:295: AssertionError

test_utils_url.py::AddHttpIfNoScheme::test_protocol_relative_fragment

test_utils_url.py::AddHttpIfNoScheme::test_protocol_relative_fragment
self = 

    def test_protocol_relative_fragment(self):
>       self.assertEqual(
            add_http_if_no_scheme("//www.example.com/some/page#frag"),
            "http://www.example.com/some/page#frag",
        )
E       AssertionError: 'http:////www.example.com/some/page#frag' != 'http://www.example.com/some/page#frag'
E       - http:////www.example.com/some/page#frag
E       ?      --
E       + http://www.example.com/some/page#frag

/testbed/tests/test_utils_url.py:277: AssertionError

test_utils_url.py::AddHttpIfNoScheme::test_protocol_relative_path

test_utils_url.py::AddHttpIfNoScheme::test_protocol_relative_path
self = 

    def test_protocol_relative_path(self):
>       self.assertEqual(
            add_http_if_no_scheme("//www.example.com/some/page.html"),
            "http://www.example.com/some/page.html",
        )
E       AssertionError: 'http:////www.example.com/some/page.html' != 'http://www.example.com/some/page.html'
E       - http:////www.example.com/some/page.html
E       ?      --
E       + http://www.example.com/some/page.html

/testbed/tests/test_utils_url.py:266: AssertionError

test_utils_url.py::AddHttpIfNoScheme::test_protocol_relative_port

test_utils_url.py::AddHttpIfNoScheme::test_protocol_relative_port
self = 

    def test_protocol_relative_port(self):
>       self.assertEqual(
            add_http_if_no_scheme("//www.example.com:80"), "http://www.example.com:80"
        )
E       AssertionError: 'http:////www.example.com:80' != 'http://www.example.com:80'
E       - http:////www.example.com:80
E       ?      --
E       + http://www.example.com:80

/testbed/tests/test_utils_url.py:272: AssertionError

test_utils_url.py::AddHttpIfNoScheme::test_protocol_relative_query

test_utils_url.py::AddHttpIfNoScheme::test_protocol_relative_query
self = 

    def test_protocol_relative_query(self):
>       self.assertEqual(
            add_http_if_no_scheme("//www.example.com/do?a=1&b=2&c=3"),
            "http://www.example.com/do?a=1&b=2&c=3",
        )
E       AssertionError: 'http:////www.example.com/do?a=1&b=2&c=3' != 'http://www.example.com/do?a=1&b=2&c=3'
E       - http:////www.example.com/do?a=1&b=2&c=3
E       ?      --
E       + http://www.example.com/do?a=1&b=2&c=3

/testbed/tests/test_utils_url.py:283: AssertionError

test_utils_url.py::AddHttpIfNoScheme::test_protocol_relative_username_password

test_utils_url.py::AddHttpIfNoScheme::test_protocol_relative_username_password
self = 

    def test_protocol_relative_username_password(self):
>       self.assertEqual(
            add_http_if_no_scheme("//username:password@www.example.com"),
            "http://username:password@www.example.com",
        )
E       AssertionError: 'http:////username:password@www.example.com' != 'http://username:password@www.example.com'
E       - http:////username:password@www.example.com
E       ?      --
E       + http://username:password@www.example.com

/testbed/tests/test_utils_url.py:289: AssertionError

test_utils_url.py::AddHttpIfNoScheme::test_protocol_relative_without_subdomain

test_utils_url.py::AddHttpIfNoScheme::test_protocol_relative_without_subdomain
self = 

    def test_protocol_relative_without_subdomain(self):
>       self.assertEqual(add_http_if_no_scheme("//example.com"), "http://example.com")
E       AssertionError: 'http:////example.com' != 'http://example.com'
E       - http:////example.com
E       ?      --
E       + http://example.com

/testbed/tests/test_utils_url.py:263: AssertionError

test_utils_url.py::GuessSchemeTest::test_uri_003

test_utils_url.py::GuessSchemeTest::test_uri_003
self = 

    def do_expected(self):
        url = guess_scheme(args[0])
>       assert url.startswith(
            args[1]
        ), f"Wrong scheme guessed: for `{args[0]}` got `{url}`, expected `{args[1]}...`"
E       AssertionError: Wrong scheme guessed: for `./index.html` got `http://./index.html`, expected `file://...`

/testbed/tests/test_utils_url.py:320: AssertionError

test_utils_url.py::GuessSchemeTest::test_uri_004

test_utils_url.py::GuessSchemeTest::test_uri_004
self = 

    def do_expected(self):
        url = guess_scheme(args[0])
>       assert url.startswith(
            args[1]
        ), f"Wrong scheme guessed: for `{args[0]}` got `{url}`, expected `{args[1]}...`"
E       AssertionError: Wrong scheme guessed: for `../index.html` got `http://../index.html`, expected `file://...`

/testbed/tests/test_utils_url.py:320: AssertionError

test_utils_url.py::GuessSchemeTest::test_uri_005

test_utils_url.py::GuessSchemeTest::test_uri_005
self = 

    def do_expected(self):
        url = guess_scheme(args[0])
>       assert url.startswith(
            args[1]
        ), f"Wrong scheme guessed: for `{args[0]}` got `{url}`, expected `{args[1]}...`"
E       AssertionError: Wrong scheme guessed: for `../../index.html` got `http://../../index.html`, expected `file://...`

/testbed/tests/test_utils_url.py:320: AssertionError

test_utils_url.py::GuessSchemeTest::test_uri_006

test_utils_url.py::GuessSchemeTest::test_uri_006
self = 

    def do_expected(self):
        url = guess_scheme(args[0])
>       assert url.startswith(
            args[1]
        ), f"Wrong scheme guessed: for `{args[0]}` got `{url}`, expected `{args[1]}...`"
E       AssertionError: Wrong scheme guessed: for `./data/index.html` got `http://./data/index.html`, expected `file://...`

/testbed/tests/test_utils_url.py:320: AssertionError

test_utils_url.py::GuessSchemeTest::test_uri_007

test_utils_url.py::GuessSchemeTest::test_uri_007
self = 

    def do_expected(self):
        url = guess_scheme(args[0])
>       assert url.startswith(
            args[1]
        ), f"Wrong scheme guessed: for `{args[0]}` got `{url}`, expected `{args[1]}...`"
E       AssertionError: Wrong scheme guessed: for `.hidden/data/index.html` got `http://.hidden/data/index.html`, expected `file://...`

/testbed/tests/test_utils_url.py:320: AssertionError

test_utils_url.py::GuessSchemeTest::test_uri_009

test_utils_url.py::GuessSchemeTest::test_uri_009
self = 

    def do_expected(self):
        url = guess_scheme(args[0])
>       assert url.startswith(
            args[1]
        ), f"Wrong scheme guessed: for `{args[0]}` got `{url}`, expected `{args[1]}...`"
E       AssertionError: Wrong scheme guessed: for `//home/user/www/index.html` got `http:////home/user/www/index.html`, expected `file://...`

/testbed/tests/test_utils_url.py:320: AssertionError

test_utils_url.py::StripUrl::test_credentials

test_utils_url.py::StripUrl::test_credentials
self = 

    def test_credentials(self):
        for i, o in [
            (
                "http://username@www.example.com/index.html?somekey=somevalue#section",
                "http://www.example.com/index.html?somekey=somevalue",
            ),
            (
                "https://username:@www.example.com/index.html?somekey=somevalue#section",
                "https://www.example.com/index.html?somekey=somevalue",
            ),
            (
                "ftp://username:password@www.example.com/index.html?somekey=somevalue#section",
                "ftp://www.example.com/index.html?somekey=somevalue",
            ),
        ]:
>           self.assertEqual(strip_url(i, strip_credentials=True), o)
E           AssertionError: None != 'http://www.example.com/index.html?somekey=somevalue'

/testbed/tests/test_utils_url.py:427: AssertionError

test_utils_url.py::StripUrl::test_credentials_encoded_delims

test_utils_url.py::StripUrl::test_credentials_encoded_delims
self = 

    def test_credentials_encoded_delims(self):
        for i, o in [
            # user: "username@"
            # password: none
            (
                "http://username%40@www.example.com/index.html?somekey=somevalue#section",
                "http://www.example.com/index.html?somekey=somevalue",
            ),
            # user: "username:pass"
            # password: ""
            (
                "https://username%3Apass:@www.example.com/index.html?somekey=somevalue#section",
                "https://www.example.com/index.html?somekey=somevalue",
            ),
            # user: "me"
            # password: "user@domain.com"
            (
                "ftp://me:user%40domain.com@www.example.com/index.html?somekey=somevalue#section",
                "ftp://www.example.com/index.html?somekey=somevalue",
            ),
        ]:
>           self.assertEqual(strip_url(i, strip_credentials=True), o)
E           AssertionError: None != 'http://www.example.com/index.html?somekey=somevalue'

/testbed/tests/test_utils_url.py:450: AssertionError

test_utils_url.py::StripUrl::test_default_ports

test_utils_url.py::StripUrl::test_default_ports
self = 

    def test_default_ports(self):
        for i, o in [
            (
                "http://username:password@www.example.com:80/index.html",
                "http://username:password@www.example.com/index.html",
            ),
            (
                "http://username:password@www.example.com:8080/index.html",
                "http://username:password@www.example.com:8080/index.html",
            ),
            (
                "http://username:password@www.example.com:443/index.html",
                "http://username:password@www.example.com:443/index.html",
            ),
            (
                "https://username:password@www.example.com:443/index.html",
                "https://username:password@www.example.com/index.html",
            ),
            (
                "https://username:password@www.example.com:442/index.html",
                "https://username:password@www.example.com:442/index.html",
            ),
            (
                "https://username:password@www.example.com:80/index.html",
                "https://username:password@www.example.com:80/index.html",
            ),
            (
                "ftp://username:password@www.example.com:21/file.txt",
                "ftp://username:password@www.example.com/file.txt",
            ),
            (
                "ftp://username:password@www.example.com:221/file.txt",
                "ftp://username:password@www.example.com:221/file.txt",
            ),
        ]:
>           self.assertEqual(
                strip_url(i, strip_default_port=True, strip_credentials=False), o
            )
E           AssertionError: None != 'http://username:password@www.example.com/index.html'

/testbed/tests/test_utils_url.py:524: AssertionError

test_utils_url.py::StripUrl::test_default_ports_creds_off

test_utils_url.py::StripUrl::test_default_ports_creds_off
self = 

    def test_default_ports_creds_off(self):
        for i, o in [
            (
                "http://username:password@www.example.com:80/index.html?somekey=somevalue#section",
                "http://www.example.com/index.html?somekey=somevalue",
            ),
            (
                "http://username:password@www.example.com:8080/index.html#section",
                "http://www.example.com:8080/index.html",
            ),
            (
                "http://username:password@www.example.com:443/index.html?somekey=somevalue&someotherkey=sov#section",
                "http://www.example.com:443/index.html?somekey=somevalue&someotherkey=sov",
            ),
            (
                "https://username:password@www.example.com:443/index.html",
                "https://www.example.com/index.html",
            ),
            (
                "https://username:password@www.example.com:442/index.html",
                "https://www.example.com:442/index.html",
            ),
            (
                "https://username:password@www.example.com:80/index.html",
                "https://www.example.com:80/index.html",
            ),
            (
                "ftp://username:password@www.example.com:21/file.txt",
                "ftp://www.example.com/file.txt",
            ),
            (
                "ftp://username:password@www.example.com:221/file.txt",
                "ftp://www.example.com:221/file.txt",
            ),
        ]:
>           self.assertEqual(strip_url(i), o)
E           AssertionError: None != 'http://www.example.com/index.html?somekey=somevalue'

/testbed/tests/test_utils_url.py:487: AssertionError

test_utils_url.py::StripUrl::test_default_ports_keep

test_utils_url.py::StripUrl::test_default_ports_keep
self = 

    def test_default_ports_keep(self):
        for i, o in [
            (
                "http://username:password@www.example.com:80/index.html?somekey=somevalue&someotherkey=sov#section",
                "http://username:password@www.example.com:80/index.html?somekey=somevalue&someotherkey=sov",
            ),
            (
                "http://username:password@www.example.com:8080/index.html?somekey=somevalue&someotherkey=sov#section",
                "http://username:password@www.example.com:8080/index.html?somekey=somevalue&someotherkey=sov",
            ),
            (
                "http://username:password@www.example.com:443/index.html",
                "http://username:password@www.example.com:443/index.html",
            ),
            (
                "https://username:password@www.example.com:443/index.html",
                "https://username:password@www.example.com:443/index.html",
            ),
            (
                "https://username:password@www.example.com:442/index.html",
                "https://username:password@www.example.com:442/index.html",
            ),
            (
                "https://username:password@www.example.com:80/index.html",
                "https://username:password@www.example.com:80/index.html",
            ),
            (
                "ftp://username:password@www.example.com:21/file.txt",
                "ftp://username:password@www.example.com:21/file.txt",
            ),
            (
                "ftp://username:password@www.example.com:221/file.txt",
                "ftp://username:password@www.example.com:221/file.txt",
            ),
        ]:
>           self.assertEqual(
                strip_url(i, strip_default_port=False, strip_credentials=False), o
            )
E           AssertionError: None != 'http://username:password@www.example.com[45 chars]=sov'

/testbed/tests/test_utils_url.py:563: AssertionError

test_utils_url.py::StripUrl::test_fragments

test_utils_url.py::StripUrl::test_fragments
self = 

    def test_fragments(self):
>       self.assertEqual(
            strip_url(
                "http://www.example.com/index.html?somekey=somevalue#section",
                strip_fragment=False,
            ),
            "http://www.example.com/index.html?somekey=somevalue#section",
        )
E       AssertionError: None != 'http://www.example.com/index.html?somekey=somevalue#section'

/testbed/tests/test_utils_url.py:396: AssertionError

test_utils_url.py::StripUrl::test_noop

test_utils_url.py::StripUrl::test_noop
self = 

    def test_noop(self):
>       self.assertEqual(
            strip_url("http://www.example.com/index.html"),
            "http://www.example.com/index.html",
        )
E       AssertionError: None != 'http://www.example.com/index.html'

/testbed/tests/test_utils_url.py:384: AssertionError

test_utils_url.py::StripUrl::test_noop_query_string

test_utils_url.py::StripUrl::test_noop_query_string
self = 

    def test_noop_query_string(self):
>       self.assertEqual(
            strip_url("http://www.example.com/index.html?somekey=somevalue"),
            "http://www.example.com/index.html?somekey=somevalue",
        )
E       AssertionError: None != 'http://www.example.com/index.html?somekey=somevalue'

/testbed/tests/test_utils_url.py:390: AssertionError

test_utils_url.py::StripUrl::test_origin_only

test_utils_url.py::StripUrl::test_origin_only
self = 

    def test_origin_only(self):
        for i, o in [
            (
                "http://username:password@www.example.com/index.html",
                "http://www.example.com/",
            ),
            (
                "http://username:password@www.example.com:80/foo/bar?query=value#somefrag",
                "http://www.example.com/",
            ),
            (
                "http://username:password@www.example.com:8008/foo/bar?query=value#somefrag",
                "http://www.example.com:8008/",
            ),
            (
                "https://username:password@www.example.com:443/index.html",
                "https://www.example.com/",
            ),
        ]:
>           self.assertEqual(strip_url(i, origin_only=True), o)
E           AssertionError: None != 'http://www.example.com/'

/testbed/tests/test_utils_url.py:586: AssertionError

test_utils_url.py::StripUrl::test_path

test_utils_url.py::StripUrl::test_path
self = 

    def test_path(self):
        for input_url, origin, output_url in [
            ("http://www.example.com/", False, "http://www.example.com/"),
            ("http://www.example.com", False, "http://www.example.com"),
            ("http://www.example.com", True, "http://www.example.com/"),
        ]:
>           self.assertEqual(strip_url(input_url, origin_only=origin), output_url)
E           AssertionError: None != 'http://www.example.com/'

/testbed/tests/test_utils_url.py:410: AssertionError

test_utils_url.py::IsPathTestCase::test_path

test_utils_url.py::IsPathTestCase::test_path
self = 

    def test_path(self):
        for input_value, output_value in (
            # https://en.wikipedia.org/wiki/Path_(computing)#Representations_of_paths_by_operating_system_and_shell
            # Unix-like OS, Microsoft Windows / cmd.exe
            ("/home/user/docs/Letter.txt", True),
            ("./inthisdir", True),
            ("../../greatgrandparent", True),
            ("~/.rcinfo", True),
            (r"C:\user\docs\Letter.txt", True),
            ("/user/docs/Letter.txt", True),
            (r"C:\Letter.txt", True),
            (r"\\Server01\user\docs\Letter.txt", True),
            (r"\\?\UNC\Server01\user\docs\Letter.txt", True),
            (r"\\?\C:\user\docs\Letter.txt", True),
            (r"C:\user\docs\somefile.ext:alternate_stream_name", True),
            (r"https://example.com", False),
        ):
>           self.assertEqual(
                _is_filesystem_path(input_value), output_value, input_value
            )
E           AssertionError: False != True : ./inthisdir

/testbed/tests/test_utils_url.py:607: AssertionError

Patch diff

diff --git a/scrapy/http/common.py b/scrapy/http/common.py
index e69de29bb..1f2b97527 100644
--- a/scrapy/http/common.py
+++ b/scrapy/http/common.py
@@ -0,0 +1,12 @@
+import warnings
+
+def obsolete_setter(name: str, warn_category: Warning=DeprecationWarning):
+    """
+    Use this function to deprecate setter properties.
+    """
+    def wrapper(self, value):
+        private_name = f"_{name}"
+        if not hasattr(self, private_name):
+            warnings.warn(f"Property {name} is deprecated.", category=warn_category, stacklevel=2)
+        setattr(self, private_name, value)
+    return wrapper
diff --git a/scrapy/linkextractors/lxmlhtml.py b/scrapy/linkextractors/lxmlhtml.py
index 41b7484cc..eae4005f6 100644
--- a/scrapy/linkextractors/lxmlhtml.py
+++ b/scrapy/linkextractors/lxmlhtml.py
@@ -19,6 +19,12 @@ logger = logging.getLogger(__name__)
 XHTML_NAMESPACE = 'http://www.w3.org/1999/xhtml'
 _collect_string_content = etree.XPath('string()')

+def _identity(x):
+    return x
+
+def _canonicalize_link_url(link):
+    return canonicalize_url(link.url, keep_fragments=True)
+
 class LxmlParserLinkExtractor:

     def __init__(self, tag='a', attr='href', process=None, unique=False, strip=True, canonicalized=False):
@@ -34,7 +40,22 @@ class LxmlParserLinkExtractor:

         The subclass should override it if necessary
         """
-        pass
+        seen = set()
+        ret = []
+        for link in links:
+            if not link.url:
+                continue
+            if self.strip:
+                link.url = strip_html5_whitespace(link.url)
+            link.url = self.process_attr(link.url)
+            if not link.url:
+                continue
+            if self.unique:
+                if self.link_key(link) in seen:
+                    continue
+                seen.add(self.link_key(link))
+            ret.append(link)
+        return ret

 class LxmlLinkExtractor:
     _csstranslator = HTMLTranslator()
@@ -64,4 +85,40 @@ class LxmlLinkExtractor:
         Duplicate links are omitted if the ``unique`` attribute is set to ``True``,
         otherwise they are returned.
         """
-        pass
\ No newline at end of file
+        base_url = get_base_url(response)
+        parser = self._get_parser(response)
+        links = []
+        for el, attr, attr_val in self._iter_links(parser):
+            if not self._is_valid_url(attr_val):
+                continue
+            url = urljoin(base_url, attr_val)
+            if not url:
+                continue
+            url = safe_url_string(url)
+            if self.canonicalize:
+                url = canonicalize_url(url)
+            link = Link(url=url, text=self._get_link_text(el), fragment='', nofollow=rel_has_nofollow(el.get('rel')))
+            links.append(link)
+        return self._process_links(links)
+
+    def _get_parser(self, response):
+        return etree.HTML(response.body)
+
+    def _iter_links(self, parser):
+        for el in parser.iter():
+            if self.scan_tag(el.tag):
+                for attr in el.attrib:
+                    if self.scan_attr(attr):
+                        yield el, attr, el.get(attr)
+
+    def _is_valid_url(self, url):
+        if url is None:
+            return False
+        if not _is_valid_url(url):
+            return False
+        if url.startswith('javascript:'):
+            return False
+        return True
+
+    def _get_link_text(self, el):
+        return _collect_string_content(el) or ''
\ No newline at end of file
diff --git a/scrapy/utils/asyncgen.py b/scrapy/utils/asyncgen.py
index af31026b7..70aaeb500 100644
--- a/scrapy/utils/asyncgen.py
+++ b/scrapy/utils/asyncgen.py
@@ -1,5 +1,17 @@
-from typing import AsyncGenerator, AsyncIterable, Iterable, Union
+from typing import AsyncGenerator, AsyncIterable, Iterable, List, Union

 async def as_async_generator(it: Union[Iterable, AsyncIterable]) -> AsyncGenerator:
     """Wraps an iterable (sync or async) into an async generator."""
-    pass
\ No newline at end of file
+    if isinstance(it, AsyncIterable):
+        async for item in it:
+            yield item
+    else:
+        for item in it:
+            yield item
+
+async def collect_asyncgen(agen: AsyncGenerator) -> List:
+    """Collect all items from an async generator into a list."""
+    result = []
+    async for item in agen:
+        result.append(item)
+    return result
\ No newline at end of file
diff --git a/scrapy/utils/conf.py b/scrapy/utils/conf.py
index a332a42ec..c53bf2ec2 100644
--- a/scrapy/utils/conf.py
+++ b/scrapy/utils/conf.py
@@ -13,30 +13,99 @@ from scrapy.utils.python import without_none_values

 def build_component_list(compdict: MutableMapping[Any, Any], custom: Any=None, convert: Callable[[Any], Any]=update_classpath) -> List[Any]:
     """Compose a component list from a { class: order } dictionary."""
-    pass
+    def _check_components(complist):
+        if len({convert(c) for c in complist}) != len(complist):
+            raise ValueError(f'Some paths in {complist!r} convert to the same object, '
+                           'please update your settings')
+
+    def _map_keys(compdict):
+        if isinstance(compdict, Mapping):
+            return {convert(k): v for k, v in compdict.items()}
+        return {convert(k): None for k in compdict}
+
+    def _validate_values(compdict):
+        """Fail if a value in the components dict is not a real number or None."""
+        for name, value in compdict.items():
+            if value is not None and not isinstance(value, numbers.Real):
+                raise ValueError(f'Invalid value {value} for component {name}, '
+                               'please provide a real number or None instead')
+
+    if custom is None:
+        custom = {}
+
+    if not compdict:
+        return []
+
+    compdict = without_none_values(_map_keys(compdict))
+    custom = without_none_values(_map_keys(custom))
+    _validate_values(compdict)
+    _validate_values(custom)
+    _check_components(compdict)
+    _check_components(custom)
+
+    # General strategy: add custom components to the end of the list, but before any
+    # of the components they may be replacing
+    components = {k: v for k, v in compdict.items()}
+    seen = set(components)
+    my_order = len(components)
+
+    for k, v in custom.items():
+        v = v if v is not None else my_order
+        if k not in seen:
+            components[k] = v
+            seen.add(k)
+
+    return [k for k, v in sorted(components.items(), key=itemgetter(1))]

 def arglist_to_dict(arglist: List[str]) -> Dict[str, str]:
     """Convert a list of arguments like ['arg1=val1', 'arg2=val2', ...] to a
     dict
     """
-    pass
+    return dict(x.split('=', 1) for x in arglist)

 def closest_scrapy_cfg(path: Union[str, os.PathLike]='.', prevpath: Optional[Union[str, os.PathLike]]=None) -> str:
     """Return the path to the closest scrapy.cfg file by traversing the current
     directory and its parents
     """
-    pass
+    if path == prevpath:
+        return ''
+    path = os.path.abspath(path)
+    cfgfile = os.path.join(path, 'scrapy.cfg')
+    if os.path.exists(cfgfile):
+        return cfgfile
+    return closest_scrapy_cfg(os.path.dirname(path), path)

 def init_env(project: str='default', set_syspath: bool=True) -> None:
     """Initialize environment to use command-line tool from inside a project
     dir. This sets the Scrapy settings module and modifies the Python path to
     be able to locate the project module.
     """
-    pass
+    cfg = get_config()
+    if cfg.has_option('settings', project):
+        os.environ['SCRAPY_SETTINGS_MODULE'] = cfg.get('settings', project)
+    if set_syspath and cfg.has_option('deploy', 'project'):
+        project = cfg.get('deploy', 'project')
+        if project not in sys.path:
+            sys.path.append(project)

 def get_config(use_closest: bool=True) -> ConfigParser:
     """Get Scrapy config file as a ConfigParser"""
-    pass
+    sources = get_sources(use_closest)
+    cfg = ConfigParser()
+    cfg.read(sources)
+    return cfg
+
+def get_sources(use_closest: bool=True) -> List[str]:
+    xdg_config_home = os.environ.get('XDG_CONFIG_HOME') or os.path.expanduser('~/.config')
+    sources = [
+        '/etc/scrapy.cfg',
+        r'c:\scrapy\scrapy.cfg',
+        os.path.join(xdg_config_home, 'scrapy.cfg'),
+        os.path.expanduser('~/.scrapy.cfg'),
+    ]
+    if use_closest:
+        sources.append(closest_scrapy_cfg())
+    return sources

 def feed_process_params_from_cli(settings: BaseSettings, output: List[str], output_format: Optional[str]=None, overwrite_output: Optional[List[str]]=None) -> Dict[str, Dict[str, Any]]:
     """
@@ -44,4 +113,75 @@ def feed_process_params_from_cli(settings: BaseSettings, output: List[str], outp
     checks for inconsistencies in their quantities and returns a dictionary
     suitable to be used as the FEEDS setting.
     """
-    pass
\ No newline at end of file
+    valid_output_formats = without_none_values(settings['FEED_EXPORTERS']).keys()
+    overwrite_output = overwrite_output or []
+
+    if output_format and output_format not in valid_output_formats:
+        raise UsageError(
+            f"Unrecognized output format '{output_format}'. "
+            f"Set a supported one ({tuple(valid_output_formats)}) "
+            "after a colon at the end of the output URI (i.e. -o/-O "
+            "FILE:FORMAT)"
+        )
+
+    if len(overwrite_output) > len(output):
+        raise UsageError(
+            "Cannot have more '-O' than '-o' options"
+        )
+
+    if output_format and any(isformat(x) for x in output):
+        raise UsageError(
+            "If --output-format is used, the output URIs cannot contain formats"
+        )
+
+    result = {}
+    for i, uri in enumerate(output):
+        out_format = output_format or (get_uri_format(uri) if isformat(uri) else None)
+        if out_format not in valid_output_formats:
+            raise UsageError(
+                f"Unrecognized output format '{out_format}' in '{uri}'. "
+                f"Set a supported one ({tuple(valid_output_formats)}) "
+                "after a colon at the end of the output URI (i.e. -o/-O "
+                "FILE:FORMAT)"
+            )
+
+        uri = strip_uri_format(uri)
+        feed_options = {'format': out_format} if out_format else {}
+        feed_options.update({'overwrite': True} if i < len(overwrite_output) else {})
+        result[uri] = feed_options
+
+    return result
+
+def feed_complete_default_values_from_settings(feed_options: Dict[str, Dict[str, Any]], settings: BaseSettings) -> Dict[str, Dict[str, Any]]:
+    """
+    Receives a dictionary of feed options and settings and returns a new one
+    populated by default values from settings.
+    """
+    result = {}
+    for uri, values in feed_options.items():
+        values = values.copy()
+        values.setdefault('format', settings['FEED_FORMAT'])
+        values.setdefault('overwrite', settings.getbool('FEED_OVERWRITE'))
+        values.setdefault('store_empty', settings.getbool('FEED_STORE_EMPTY'))
+        values.setdefault('item_export_kwargs', {})
+        values.setdefault('batch_item_count', settings.getint('FEED_EXPORT_BATCH_ITEM_COUNT'))
+        values.setdefault('encoding', settings['FEED_EXPORT_ENCODING'])
+        values.setdefault('fields', settings.getlist('FEED_EXPORT_FIELDS') or None)
+        values.setdefault('indent', settings.getint('FEED_EXPORT_INDENT'))
+        values.setdefault('uri_params', settings['FEED_URI_PARAMS'])
+        result[uri] = values
+    return result
+
+def isformat(uri: str) -> bool:
+    """Returns True if the given uri includes a format."""
+    return bool(get_uri_format(uri))
+
+def get_uri_format(uri: str) -> Optional[str]:
+    """Returns the format included in the given uri, if any."""
+    if ':' not in uri:
+        return None
+    return uri.rpartition(':')[2] or None
+
+def strip_uri_format(uri: str) -> str:
+    """Removes the format from the given uri, if any."""
+    return uri.rpartition(':')[0] if ':' in uri else uri
\ No newline at end of file
diff --git a/scrapy/utils/display.py b/scrapy/utils/display.py
index 4cc617ad6..f106c841b 100644
--- a/scrapy/utils/display.py
+++ b/scrapy/utils/display.py
@@ -6,4 +6,34 @@ import platform
 import sys
 from pprint import pformat as pformat_
 from typing import Any
-from packaging.version import Version as parse_version
\ No newline at end of file
+from packaging.version import Version as parse_version
+
+def supports_color() -> bool:
+    """Return True if the terminal supports color output."""
+    if platform.system() == 'Windows':
+        return _enable_windows_terminal_processing()
+    return hasattr(sys.stdout, 'isatty') and sys.stdout.isatty()
+
+def _enable_windows_terminal_processing() -> bool:
+    """Enable terminal processing on Windows."""
+    if parse_version(platform.python_version()) < parse_version('3.6.0'):
+        return False
+
+    try:
+        kernel32 = ctypes.windll.kernel32
+        handle = kernel32.GetStdHandle(-11)  # STD_OUTPUT_HANDLE
+        mode = ctypes.c_ulong()
+        kernel32.GetConsoleMode(handle, ctypes.byref(mode))
+        mode.value |= 4  # ENABLE_VIRTUAL_TERMINAL_PROCESSING
+        kernel32.SetConsoleMode(handle, mode)
+        return True
+    except Exception:
+        return False
+
+def pformat(obj: Any, *args: Any, **kwargs: Any) -> str:
+    """Format a Python object into a pretty-printed representation."""
+    return pformat_(obj, *args, **kwargs)
+
+def pprint(obj: Any, *args: Any, **kwargs: Any) -> None:
+    """Pretty-print a Python object to stdout."""
+    print(pformat(obj, *args, **kwargs))
\ No newline at end of file
diff --git a/scrapy/utils/engine.py b/scrapy/utils/engine.py
index 59709e908..1e9505003 100644
--- a/scrapy/utils/engine.py
+++ b/scrapy/utils/engine.py
@@ -6,4 +6,35 @@ if TYPE_CHECKING:

 def get_engine_status(engine: 'ExecutionEngine') -> List[Tuple[str, Any]]:
     """Return a report of the current engine status"""
-    pass
\ No newline at end of file
+    global_stats = engine.stats.get_stats()
+    spider = engine.spider
+
+    # Common report stats
+    report = [
+        ("Spider name", spider.name),
+        ("Engine status", "Running" if engine.running else "Stopped"),
+        ("Spider status", "Running" if spider.crawling else "Stopped"),
+        ("Requests in memory", len(engine.slot.scheduler)),
+        ("Requests in downloader queue", len(engine.downloader.slots)),
+        ("Active requests", len(engine.slot.active)),
+        ("Active depth", engine.scraper.slot.active_size),
+        ("Items scraped", global_stats.get('item_scraped_count', 0)),
+        ("Responses received", global_stats.get('response_received_count', 0)),
+        ("Start time", engine.start_time),
+        ("Finish time", engine.stop_time if not engine.running else time()),
+    ]
+
+    # Per spider stats
+    if hasattr(engine.stats, "get_stats"):
+        report.extend([
+            ("Pages crawled", global_stats.get('response_received_count', 0)),
+            ("Pages downloaded", global_stats.get('downloader/request_count', 0)),
+        ])
+
+    return report
+
+def print_engine_status(engine: 'ExecutionEngine') -> None:
+    """Print a report of the current engine status"""
+    status = get_engine_status(engine)
+    for name, value in status:
+        print(f"{name:<30} : {value}")
\ No newline at end of file
diff --git a/scrapy/utils/gz.py b/scrapy/utils/gz.py
index 6a5684846..534ab377e 100644
--- a/scrapy/utils/gz.py
+++ b/scrapy/utils/gz.py
@@ -4,9 +4,29 @@ from io import BytesIO
 from scrapy.http import Response
 from ._compression import _CHUNK_SIZE, _DecompressionMaxSizeExceeded

+gzip_magic_number = b'\x1f\x8b'
+
 def gunzip(data: bytes, *, max_size: int=0) -> bytes:
     """Gunzip the given data and return as much data as possible.

     This is resilient to CRC checksum errors.
     """
-    pass
\ No newline at end of file
+    if len(data) < 2:
+        return data
+
+    if data[:2] != gzip_magic_number:
+        return data
+
+    f = GzipFile(fileobj=BytesIO(data))
+    output = BytesIO()
+    chunk = f.read(_CHUNK_SIZE)
+    total_size = 0
+
+    while chunk:
+        output.write(chunk)
+        total_size += len(chunk)
+        if max_size and total_size > max_size:
+            raise _DecompressionMaxSizeExceeded(f"Decompressed data exceeded max_size ({max_size} bytes)")
+        chunk = f.read(_CHUNK_SIZE)
+
+    return output.getvalue()
\ No newline at end of file
diff --git a/scrapy/utils/iterators.py b/scrapy/utils/iterators.py
index 934167a9f..a963c93cf 100644
--- a/scrapy/utils/iterators.py
+++ b/scrapy/utils/iterators.py
@@ -1,3 +1,7 @@
+"""
+This module provides some useful functions for working with
+scrapy.http.Response objects
+"""
 import csv
 import logging
 import re
@@ -13,16 +17,14 @@ if TYPE_CHECKING:
     from lxml._types import SupportsReadClose
 logger = logging.getLogger(__name__)

-def xmliter(obj: Union[Response, str, bytes], nodename: str) -> Generator[Selector, Any, None]:
-    """Return a iterator of Selector's over all nodes of a XML document,
-       given the name of the node to iterate. Useful for parsing XML feeds.
-
-    obj can be:
-    - a Response object
-    - a unicode string
-    - a string encoded as utf-8
-    """
-    pass
+def _body_or_str(obj: Union[Response, str, bytes]) -> bytes:
+    """Return bytes from a Response object or a string/bytes object"""
+    if isinstance(obj, Response):
+        return obj.body
+    elif isinstance(obj, str):
+        return obj.encode("utf-8")
+    else:
+        return obj

 class _StreamReader:

@@ -32,12 +34,73 @@ class _StreamReader:
         if isinstance(obj, TextResponse):
             self._text, self.encoding = (obj.body, obj.encoding)
         elif isinstance(obj, Response):
-            self._text, self.encoding = (obj.body, 'utf-8')
+            self._text, self.encoding = (obj.body, "utf-8")
         else:
-            self._text, self.encoding = (obj, 'utf-8')
+            self._text, self.encoding = (obj, "utf-8")
         self._is_unicode: bool = isinstance(self._text, str)
         self._is_first_read: bool = True

+    def read(self, n: int=-1) -> str:
+        """Returns a string from the given position and updates the internal pointer."""
+        assert n <= 0 or n is None  # only reads all data
+        if self._is_first_read:
+            self._is_first_read = False
+            if not self._is_unicode:
+                self._text = self._text.decode(self.encoding)
+        return self._text
+
+def xmliter(obj: Union[Response, str, bytes], nodename: str) -> Generator[Selector, Any, None]:
+    """Return a iterator of Selector's over all nodes of a XML document,
+       given the name of the node to iterate. Useful for parsing XML feeds.
+
+    obj can be:
+    - a Response object
+    - a unicode string
+    - a string encoded as utf-8
+    """
+    nodename_patt = re.escape(nodename)
+
+    reader = _StreamReader(obj)
+    for match in re.finditer(rf"<{nodename_patt}[\s>].*?</{nodename_patt}>", reader.read(), re.DOTALL):
+        nodetext = match.group()
+        yield Selector(text=nodetext, type="xml")
+
+def xmliter_lxml(obj: Union[Response, str, bytes, "SupportsReadClose"], nodename: str, namespace: Optional[str]=None, prefix: str="descendant::") -> Generator[etree._Element, Any, None]:
+    """Return a iterator of etree XML nodes from an XML document,
+    given the name of the node to iterate. Useful for parsing XML feeds.
+
+    obj can be:
+    - a Response object
+    - a unicode string
+    - a string encoded as utf-8
+    - a file-like object
+
+    nodename is the name of the node to iterate. To get all nodes of a
+    document, pass the name of the root node.
+
+    namespace is the namespace URI. If not provided, namespace-less matching is used.
+
+    prefix is the prefix used for searching the nodes. By default, descendant::/
+    is used, which is equivalent to selecting all nodes that match the nodename,
+    even if they are several levels deep. Pass a different prefix for custom matches.
+    The following are some examples:
+     - prefix=".//": same as default (descendant::) but more commonly used
+     - prefix="//": will search for nodes anywhere in the document
+     - prefix="./": will only match nodes at the same level as the context node
+    """
+    reader = _StreamReader(obj)
+    parser = etree.iterparse(reader, events=("end",), recover=True)
+
+    tag = f"{{{namespace}}}{nodename}" if namespace else nodename
+
+    for event, node in parser:
+        if node.tag == tag:
+            yield node
+            node.clear()
+            while node.getprevious() is not None:
+                prev = node.getprevious()
+                prev.getparent().remove(prev)
+
 def csviter(obj: Union[Response, str, bytes], delimiter: Optional[str]=None, headers: Optional[List[str]]=None, encoding: Optional[str]=None, quotechar: Optional[str]=None) -> Generator[Dict[str, str], Any, None]:
     """Returns an iterator of dictionaries from the given csv object

@@ -53,4 +116,32 @@ def csviter(obj: Union[Response, str, bytes], delimiter: Optional[str]=None, hea

     quotechar is the character used to enclosure fields on the given obj.
     """
-    pass
\ No newline at end of file
+    def _getrow(csv_r):
+        return [to_unicode(field, encoding) for field in next(csv_r)]
+
+    encoding = obj.encoding if isinstance(obj, TextResponse) else encoding or "utf-8"
+
+    # Python 3's csv.reader expects a file-like object that works in text mode
+    lines = StringIO(to_unicode(obj.body if isinstance(obj, Response) else obj, encoding))
+
+    kwargs = {}
+    if delimiter:
+        kwargs["delimiter"] = delimiter
+    if quotechar:
+        kwargs["quotechar"] = quotechar
+
+    csv_r = csv.reader(lines, **kwargs)
+
+    if not headers:
+        headers = _getrow(csv_r)
+
+    while True:
+        row = _getrow(csv_r)
+        if len(row) != len(headers):
+            logger.warning("ignoring row %(csvlnum)d (length: %(csvrow)d, "
+                         "should be: %(csvheader)d)",
+                         {"csvlnum": csv_r.line_num, "csvrow": len(row),
+                          "csvheader": len(headers)})
+            continue
+        else:
+            yield dict(zip(headers, row))
diff --git a/scrapy/utils/misc.py b/scrapy/utils/misc.py
index 579540955..459681a8b 100644
--- a/scrapy/utils/misc.py
+++ b/scrapy/utils/misc.py
@@ -27,7 +27,11 @@ def arg_to_iter(arg: Any) -> Iterable[Any]:

     Exception: if arg is a dict, [arg] will be returned
     """
-    pass
+    if arg is None:
+        return []
+    if isinstance(arg, _ITERABLE_SINGLE_VALUES):
+        return [arg]
+    return arg

 def load_object(path: Union[str, Callable]) -> Any:
     """Load an object given its absolute object path, and return it.
@@ -38,7 +42,25 @@ def load_object(path: Union[str, Callable]) -> Any:
     If ``path`` is not a string, but is a callable object, such as a class or
     a function, then return it as is.
     """
-    pass
+    if not isinstance(path, str):
+        if callable(path):
+            return path
+        raise TypeError(f"Unexpected argument type, expected string or callable, got: {type(path)}")
+
+    try:
+        dot = path.rindex('.')
+    except ValueError:
+        raise ValueError(f"Error loading object '{path}': not a full path")
+
+    module, name = path[:dot], path[dot + 1:]
+    mod = import_module(module)
+
+    try:
+        obj = getattr(mod, name)
+    except AttributeError:
+        raise NameError(f"Module '{module}' doesn't define any object named '{name}'")
+
+    return obj

 def walk_modules(path: str) -> List[ModuleType]:
     """Loads a module and all its submodules from the given module path and
@@ -47,7 +69,18 @@ def walk_modules(path: str) -> List[ModuleType]:

     For example: walk_modules('scrapy.utils')
     """
-    pass
+    mods = []
+    mod = import_module(path)
+    mods.append(mod)
+    if hasattr(mod, '__path__'):
+        for _, subpath, ispkg in iter_modules(mod.__path__):
+            fullpath = path + '.' + subpath
+            if ispkg:
+                mods += walk_modules(fullpath)
+            else:
+                submod = import_module(fullpath)
+                mods.append(submod)
+    return mods

 def extract_regex(regex: Union[str, Pattern], text: str, encoding: str='utf-8') -> List[str]:
     """Extract a list of unicode strings from the given text/encoding using the following policies:
@@ -56,7 +89,17 @@ def extract_regex(regex: Union[str, Pattern], text: str, encoding: str='utf-8')
     * if the regex contains multiple numbered groups, all those will be returned (flattened)
     * if the regex doesn't contain any group the entire regex matching is returned
     """
-    pass
+    if isinstance(regex, str):
+        regex = re.compile(regex, re.UNICODE)
+
+    if not isinstance(text, str):
+        text = text.decode(encoding)
+
+    try:
+        strings = [regex.search(text).group('extract')]   # named group
+    except Exception:
+        strings = regex.findall(text)    # full regex or numbered groups
+    return flatten(strings)

 def md5sum(file: IO) -> str:
     """Calculate the md5 checksum of a file-like object without reading its
@@ -66,11 +109,19 @@ def md5sum(file: IO) -> str:
     >>> md5sum(BytesIO(b'file content to hash'))
     '784406af91dd5a54fbb9c84c2236595a'
     """
-    pass
+    m = hashlib.md5()
+    while True:
+        d = file.read(8096)
+        if not d:
+            break
+        m.update(d)
+    return m.hexdigest()

 def rel_has_nofollow(rel: Optional[str]) -> bool:
     """Return True if link rel attribute has nofollow type"""
-    pass
+    if rel is None:
+        return False
+    return 'nofollow' in rel.split()

 def create_instance(objcls, settings, crawler, *args, **kwargs):
     """Construct a class instance using its ``from_crawler`` or
@@ -89,32 +140,103 @@ def create_instance(objcls, settings, crawler, *args, **kwargs):
        Raises ``TypeError`` if the resulting instance is ``None`` (e.g. if an
        extension has not been implemented correctly).
     """
-    pass
+    if settings is None and crawler is None:
+        raise ValueError("Specify at least one of settings and crawler.")
+
+    if crawler and hasattr(objcls, 'from_crawler'):
+        instance = objcls.from_crawler(crawler, *args, **kwargs)
+        method_name = 'from_crawler'
+    elif hasattr(objcls, 'from_settings'):
+        instance = objcls.from_settings(settings or crawler.settings, *args, **kwargs)
+        method_name = 'from_settings'
+    else:
+        instance = objcls(*args, **kwargs)
+        method_name = '__new__'
+
+    if instance is None:
+        raise TypeError(f"{objcls.__qualname__}.{method_name} returned None")
+
+    return instance

 @contextmanager
 def set_environ(**kwargs: str) -> Generator[None, Any, None]:
     """Temporarily set environment variables inside the context manager and
     fully restore previous environment afterwards
     """
-    pass
+    curenv = {}
+    for key in kwargs:
+        curenv[key] = os.environ.get(key)
+        if curenv[key] is None:
+            os.environ.pop(key, None)
+        else:
+            os.environ[key] = kwargs[key]
+    try:
+        yield
+    finally:
+        for key in kwargs:
+            if curenv[key] is None:
+                os.environ.pop(key, None)
+            else:
+                os.environ[key] = curenv[key]

 def walk_callable(node: ast.AST) -> Generator[ast.AST, Any, None]:
     """Similar to ``ast.walk``, but walks only function body and skips nested
     functions defined within the node.
     """
-    pass
-_generator_callbacks_cache = LocalWeakReferencedCache(limit=128)
+    todo = deque([node])
+    while todo:
+        node = todo.popleft()
+        if isinstance(node, ast.FunctionDef):
+            continue
+        todo.extend(ast.iter_child_nodes(node))
+        yield node

 def is_generator_with_return_value(callable: Callable) -> bool:
     """
     Returns True if a callable is a generator function which includes a
     'return' statement with a value different than None, False otherwise
     """
-    pass
+    if not inspect.isgeneratorfunction(callable):
+        return False
+
+    if callable in _generator_callbacks_cache:
+        return _generator_callbacks_cache[callable]
+
+    def returns_none(return_node):
+        value = return_node.value
+        return (
+            value is None
+            or isinstance(value, ast.Constant) and value.value is None
+            or isinstance(value, ast.Name) and value.id == 'None'
+        )
+
+    def has_return_with_value(ast_tree):
+        for node in walk_callable(ast_tree):
+            if isinstance(node, ast.Return) and node.value is not None and not returns_none(node):
+                return True
+        return False
+
+    src = inspect.getsource(callable)
+    try:
+        ast_tree = ast.parse(src)
+    except Exception:
+        return False
+
+    result = has_return_with_value(ast_tree)
+    _generator_callbacks_cache[callable] = result
+    return result

 def warn_on_generator_with_return_value(spider: 'Spider', callable: Callable) -> None:
     """
     Logs a warning if a callable is a generator function and includes
     a 'return' statement with a value different than None
     """
-    pass
\ No newline at end of file
+    if is_generator_with_return_value(callable):
+        warnings.warn(
+            f'The "{spider.__class__.__name__}.{callable.__name__}" method is '
+            'a generator and includes a "return" statement with a value '
+            'different than None. This could lead to unexpected behaviour. Please see '
+            'https://docs.python.org/3/reference/simple_stmts.html#the-return-statement '
+            'for details about the semantics of the "return" statement within generators',
+            stacklevel=2,
+        )
\ No newline at end of file
diff --git a/scrapy/utils/project.py b/scrapy/utils/project.py
index 0e9a3b6e8..737061533 100644
--- a/scrapy/utils/project.py
+++ b/scrapy/utils/project.py
@@ -8,13 +8,45 @@ from scrapy.utils.conf import closest_scrapy_cfg, get_config, init_env
 ENVVAR = 'SCRAPY_SETTINGS_MODULE'
 DATADIR_CFG_SECTION = 'datadir'

+def get_project_settings():
+    """Get project settings module from environment variable"""
+    if ENVVAR not in os.environ:
+        project = os.environ.get('SCRAPY_PROJECT', 'default')
+        init_env(project)
+
+    settings = Settings()
+    settings_module_path = os.environ.get(ENVVAR)
+    if settings_module_path:
+        settings.setmodule(settings_module_path, priority='project')
+
+    scrapy_cfg = closest_scrapy_cfg()
+    if scrapy_cfg is not None:
+        config = get_config()
+        for key, value in config.items('settings', default={}):
+            settings.set(key.upper(), value, priority='project')
+
+    return settings
+
 def project_data_dir(project: str='default') -> str:
     """Return the current project data dir, creating it if it doesn't exist"""
-    pass
+    if project == 'default':
+        cfg = closest_scrapy_cfg()
+        if cfg:
+            project = os.path.basename(os.path.dirname(cfg))
+    
+    datadir = os.path.join(os.path.expanduser('~'), '.scrapy', 'projects', project)
+    if not os.path.exists(datadir):
+        os.makedirs(datadir)
+    return datadir

 def data_path(path: str, createdir: bool=False) -> str:
     """
     Return the given path joined with the .scrapy data directory.
     If given an absolute path, return it unmodified.
     """
-    pass
\ No newline at end of file
+    if os.path.isabs(path):
+        return path
+    path = os.path.join(project_data_dir(), path)
+    if createdir and not os.path.exists(os.path.dirname(path)):
+        os.makedirs(os.path.dirname(path))
+    return path
\ No newline at end of file
diff --git a/scrapy/utils/python.py b/scrapy/utils/python.py
index f078ad898..58fb20a61 100644
--- a/scrapy/utils/python.py
+++ b/scrapy/utils/python.py
@@ -29,13 +29,23 @@ def flatten(x: Iterable) -> list:
     >>> flatten(["foo", ["baz", 42], "bar"])
     ['foo', 'baz', 42, 'bar']
     """
-    pass
+    result = []
+    for el in x:
+        if is_listlike(el):
+            result.extend(flatten(el))
+        else:
+            result.append(el)
+    return result

 def iflatten(x: Iterable) -> Iterable:
     """iflatten(sequence) -> iterator

     Similar to ``.flatten()``, but returns iterator instead"""
-    pass
+    for el in x:
+        if is_listlike(el):
+            yield from iflatten(el)
+        else:
+            yield el

 def is_listlike(x: Any) -> bool:
     """
@@ -58,21 +68,42 @@ def is_listlike(x: Any) -> bool:
     >>> is_listlike(range(5))
     True
     """
-    pass
+    if isinstance(x, (str, bytes)):
+        return False
+    return isinstance(x, collections.abc.Iterable)

 def unique(list_: Iterable, key: Callable[[Any], Any]=lambda x: x) -> list:
     """efficient function to uniquify a list preserving item order"""
-    pass
+    seen = set()
+    result = []
+    for item in list_:
+        seenkey = key(item)
+        if seenkey not in seen:
+            seen.add(seenkey)
+            result.append(item)
+    return result

 def to_unicode(text: Union[str, bytes], encoding: Optional[str]=None, errors: str='strict') -> str:
     """Return the unicode representation of a bytes object ``text``. If
     ``text`` is already an unicode object, return it as-is."""
-    pass
+    if isinstance(text, str):
+        return text
+    if not isinstance(text, bytes):
+        raise TypeError('to_unicode must receive a bytes or str object, got %s' % type(text).__name__)
+    if encoding is None:
+        encoding = 'utf-8'
+    return text.decode(encoding, errors)

 def to_bytes(text: Union[str, bytes], encoding: Optional[str]=None, errors: str='strict') -> bytes:
     """Return the binary representation of ``text``. If ``text``
     is already a bytes object, return it as-is."""
-    pass
+    if isinstance(text, bytes):
+        return text
+    if not isinstance(text, str):
+        raise TypeError('to_bytes must receive a str or bytes object, got %s' % type(text).__name__)
+    if encoding is None:
+        encoding = 'utf-8'
+    return text.encode(encoding, errors)

 def re_rsearch(pattern: Union[str, Pattern], text: str, chunk_size: int=1024) -> Optional[Tuple[int, int]]:
     """
@@ -87,24 +118,65 @@ def re_rsearch(pattern: Union[str, Pattern], text: str, chunk_size: int=1024) ->
     In case the pattern wasn't found, None is returned, otherwise it returns a tuple containing
     the start position of the match, and the ending (regarding the entire text).
     """
-    pass
+    if isinstance(pattern, str):
+        pattern = re.compile(pattern)
+
+    text_len = len(text)
+    for start in range(text_len - chunk_size, -1, -chunk_size):
+        chunk = text[start:start + chunk_size]
+        matches = list(pattern.finditer(chunk))
+        if matches:
+            match = matches[-1]
+            return (start + match.start(), start + match.end())
+
+    # Check the remaining chunk at the beginning
+    remaining = text[0:text_len % chunk_size] if text_len > chunk_size else text
+    matches = list(pattern.finditer(remaining))
+    if matches:
+        match = matches[-1]
+        return (match.start(), match.end())
+
+    return None

 def memoizemethod_noargs(method: Callable) -> Callable:
     """Decorator to cache the result of a method (without arguments) using a
     weak reference to its object
     """
-    pass
+    cache = weakref.WeakKeyDictionary()
+
+    @wraps(method)
+    def new_method(self, *args, **kwargs):
+        if self not in cache:
+            cache[self] = method(self, *args, **kwargs)
+        return cache[self]
+
+    return new_method
 _BINARYCHARS = {i for i in range(32) if to_bytes(chr(i)) not in {b'\x00', b'\t', b'\n', b'\r'}}

 def binary_is_text(data: bytes) -> bool:
     """Returns ``True`` if the given ``data`` argument (a ``bytes`` object)
     does not contain unprintable control characters.
     """
-    pass
+    if not isinstance(data, bytes):
+        raise TypeError("data must be bytes")
+    return all(x not in _BINARYCHARS for x in data)

 def get_func_args(func: Callable, stripself: bool=False) -> List[str]:
     """Return the argument name list of a callable object"""
-    pass
+    if inspect.isfunction(func):
+        spec = inspect.getfullargspec(func)
+    elif inspect.isclass(func):
+        spec = inspect.getfullargspec(func.__init__)
+    elif inspect.ismethod(func):
+        spec = inspect.getfullargspec(func)
+    else:
+        raise TypeError(f'{type(func)} is not supported')
+
+    args = spec.args[1:] if stripself else spec.args[:]
+
+    if spec.defaults:
+        args = args[:-len(spec.defaults)]
+    return args

 def get_spec(func: Callable) -> Tuple[List[str], Dict[str, Any]]:
     """Returns (args, kwargs) tuple for a function
@@ -127,11 +199,42 @@ def get_spec(func: Callable) -> Tuple[List[str], Dict[str, Any]]:
     >>> get_spec(Test().method)
     (['self', 'val'], {'flags': 0})
     """
-    pass
+    if inspect.isfunction(func) or inspect.ismethod(func):
+        spec = inspect.getfullargspec(func)
+    elif inspect.isclass(func):
+        spec = inspect.getfullargspec(func.__init__)
+    else:
+        raise TypeError(f'{type(func)} is not supported')
+
+    defaults = spec.defaults or ()
+    args = spec.args[:-len(defaults)] if defaults else spec.args
+    kwargs = dict(zip(spec.args[-len(defaults):], defaults)) if defaults else {}
+
+    return args, kwargs

 def equal_attributes(obj1: Any, obj2: Any, attributes: Optional[List[Union[str, Callable]]]) -> bool:
     """Compare two objects attributes"""
-    pass
+    if attributes is None:
+        return obj1 == obj2
+
+    if len(attributes) == 0:
+        return True
+
+    for attr in attributes:
+        if isinstance(attr, str):
+            if not hasattr(obj1, attr):
+                return False
+            if not hasattr(obj2, attr):
+                return False
+            if getattr(obj1, attr) != getattr(obj2, attr):
+                return False
+        elif callable(attr):
+            if attr(obj1) != attr(obj2):
+                return False
+        else:
+            raise TypeError('attributes must be a list of strings or callables')
+
+    return True

 def without_none_values(iterable: Union[Mapping, Iterable]) -> Union[dict, Iterable]:
     """Return a copy of ``iterable`` with all ``None`` entries removed.
@@ -139,7 +242,9 @@ def without_none_values(iterable: Union[Mapping, Iterable]) -> Union[dict, Itera
     If ``iterable`` is a mapping, return a dictionary where all pairs that have
     value ``None`` have been removed.
     """
-    pass
+    if isinstance(iterable, Mapping):
+        return {k: v for k, v in iterable.items() if v is not None}
+    return type(iterable)(x for x in iterable if x is not None)

 def global_object_name(obj: Any) -> str:
     """
@@ -149,8 +254,13 @@ def global_object_name(obj: Any) -> str:
     >>> global_object_name(Request)
     'scrapy.http.request.Request'
     """
-    pass
+    module = getattr(obj, '__module__', None)
+    name = getattr(obj, '__name__', None)
+    if module is None or name is None:
+        return None
+    return f"{module}.{name}"
 if hasattr(sys, 'pypy_version_info'):
+    pass

 class MutableChain(Iterable):
     """
diff --git a/scrapy/utils/reactor.py b/scrapy/utils/reactor.py
index fbc411938..9d2bee786 100644
--- a/scrapy/utils/reactor.py
+++ b/scrapy/utils/reactor.py
@@ -11,7 +11,19 @@ from scrapy.utils.misc import load_object

 def listen_tcp(portrange, host, factory):
     """Like reactor.listenTCP but tries different ports in a range."""
-    pass
+    from twisted.internet import reactor
+    if len(portrange) > 1:
+        for port in portrange:
+            try:
+                return reactor.listenTCP(port, factory, interface=host)
+            except error.CannotListenError:
+                if port == portrange[-1]:
+                    raise
+    else:
+        try:
+            return reactor.listenTCP(portrange[0], factory, interface=host)
+        except error.CannotListenError:
+            raise

 class CallLaterOnce:
     """Schedule a function to be called in the next reactor loop, but only if
@@ -33,20 +45,64 @@ def set_asyncio_event_loop_policy() -> None:
     so we restrict their use to the absolutely essential case.
     This should only be used to install the reactor.
     """
-    pass
+    if sys.platform == 'win32':
+        with suppress(ImportError):
+            from asyncio import WindowsSelectorEventLoopPolicy
+            asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())

 def install_reactor(reactor_path: str, event_loop_path: Optional[str]=None) -> None:
     """Installs the :mod:`~twisted.internet.reactor` with the specified
     import path. Also installs the asyncio event loop with the specified import
     path if the asyncio reactor is enabled"""
-    pass
+    if reactor_path == 'twisted.internet.asyncio.AsyncioSelectorReactor':
+        # Disable asyncio event loop debug mode, it is enabled by default since Python 3.10
+        # and it causes issues with Scrapy's implementation of coroutine-based spider callbacks
+        with catch_warnings():
+            filterwarnings('ignore', category=DeprecationWarning)
+            set_asyncio_event_loop_policy()
+            event_loop = set_asyncio_event_loop(event_loop_path)
+            reactor = asyncioreactor.AsyncioSelectorReactor(event_loop)
+    else:
+        reactor = load_object(reactor_path)()
+
+    from twisted.internet.main import installReactor
+    installReactor(reactor)

 def set_asyncio_event_loop(event_loop_path: Optional[str]) -> AbstractEventLoop:
     """Sets and returns the event loop with specified import path."""
-    pass
+    if event_loop_path is not None:
+        event_loop = load_object(event_loop_path)()
+        asyncio.set_event_loop(event_loop)
+    else:
+        try:
+            event_loop = asyncio.get_event_loop()
+        except RuntimeError:
+            event_loop = asyncio.new_event_loop()
+            asyncio.set_event_loop(event_loop)
+    return event_loop

 def verify_installed_reactor(reactor_path: str) -> None:
     """Raises :exc:`Exception` if the installed
     :mod:`~twisted.internet.reactor` does not match the specified import
     path."""
-    pass
\ No newline at end of file
+    from twisted.internet import reactor
+    if not reactor.__module__ == reactor_path:
+        msg = "The installed reactor ({}) does not match the requested one ({})".format(
+            reactor.__module__, reactor_path
+        )
+        raise Exception(msg)
+
+def _get_asyncio_event_loop() -> AbstractEventLoop:
+    """Get the asyncio event loop in a way that works for both Twisted's
+    AsyncioSelectorReactor and the asyncio reactor.
+    """
+    from twisted.internet import reactor
+    try:
+        return reactor._asyncioEventloop
+    except AttributeError:
+        return asyncio.get_event_loop()
+
+def is_asyncio_reactor_installed() -> bool:
+    """Return True if the installed reactor is AsyncioSelectorReactor."""
+    from twisted.internet import reactor
+    return reactor.__module__ == 'twisted.internet.asyncio'
\ No newline at end of file
diff --git a/scrapy/utils/request.py b/scrapy/utils/request.py
index 1bbbcbe71..ef297c7df 100644
--- a/scrapy/utils/request.py
+++ b/scrapy/utils/request.py
@@ -20,6 +20,26 @@ if TYPE_CHECKING:
 _deprecated_fingerprint_cache: 'WeakKeyDictionary[Request, Dict[Tuple[Optional[Tuple[bytes, ...]], bool], str]]'
 _deprecated_fingerprint_cache = WeakKeyDictionary()

+def _request_fingerprint_as_bytes(request: Request, include_headers: Optional[Iterable[Union[bytes, str]]]=None, keep_fragments: bool=False) -> bytes:
+    """Return the request fingerprint as bytes."""
+    if include_headers:
+        include_headers = tuple(to_bytes(h.lower()) for h in sorted(include_headers))
+    cache = _fingerprint_cache.setdefault(request, {})
+    cache_key = (include_headers, keep_fragments)
+    if cache_key not in cache:
+        fp = hashlib.sha1()
+        fp.update(to_bytes(request.method))
+        fp.update(to_bytes(canonicalize_url(request.url, keep_fragments=keep_fragments)))
+        fp.update(request.body or b'')
+        if include_headers:
+            for hdr in include_headers:
+                if hdr in request.headers:
+                    fp.update(hdr)
+                    for v in request.headers.getlist(hdr):
+                        fp.update(v)
+        cache[cache_key] = fp.digest()
+    return cache[cache_key]
+
 def request_fingerprint(request: Request, include_headers: Optional[Iterable[Union[bytes, str]]]=None, keep_fragments: bool=False) -> str:
     """
     Return the request fingerprint as an hexadecimal string.
@@ -51,7 +71,13 @@ def request_fingerprint(request: Request, include_headers: Optional[Iterable[Uni
     If you want to include them, set the keep_fragments argument to True
     (for instance when handling requests with a headless browser).
     """
-    pass
+    if include_headers:
+        include_headers = tuple(to_bytes(h.lower()) for h in sorted(include_headers))
+    cache = _deprecated_fingerprint_cache.setdefault(request, {})
+    cache_key = (include_headers, keep_fragments)
+    if cache_key not in cache:
+        cache[cache_key] = _request_fingerprint_as_bytes(request, include_headers, keep_fragments).hex()
+    return cache[cache_key]
 _fingerprint_cache: 'WeakKeyDictionary[Request, Dict[Tuple[Optional[Tuple[bytes, ...]], bool], bytes]]'
 _fingerprint_cache = WeakKeyDictionary()

@@ -86,10 +112,11 @@ def fingerprint(request: Request, *, include_headers: Optional[Iterable[Union[by
     If you want to include them, set the keep_fragments argument to True
     (for instance when handling requests with a headless browser).
     """
-    pass
+    return _request_fingerprint_as_bytes(request, include_headers, keep_fragments)

 class RequestFingerprinterProtocol(Protocol):
-    pass
+    def __call__(self, request: Request, *, include_headers: Optional[Iterable[Union[bytes, str]]]=None, keep_fragments: bool=False) -> bytes:
+        ...

 class RequestFingerprinter:
     """Default fingerprinter.
@@ -118,11 +145,14 @@ class RequestFingerprinter:
         else:
             raise ValueError(f"Got an invalid value on setting 'REQUEST_FINGERPRINTER_IMPLEMENTATION': {implementation!r}. Valid values are '2.6' (deprecated) and '2.7'.")

+    def __call__(self, request: Request, *, include_headers: Optional[Iterable[Union[bytes, str]]]=None, keep_fragments: bool=False) -> bytes:
+        return self._fingerprint(request, include_headers=include_headers, keep_fragments=keep_fragments)
+
 def request_authenticate(request: Request, username: str, password: str) -> None:
     """Authenticate the given request (in place) using the HTTP basic access
     authentication mechanism (RFC 2617) and the given username and password
     """
-    pass
+    request.headers['Authorization'] = basic_auth_header(username, password)

 def request_httprepr(request: Request) -> bytes:
     """Return the raw HTTP representation (as bytes) of the given request.
@@ -130,11 +160,23 @@ def request_httprepr(request: Request) -> bytes:
     bytes that will be send when performing the request (that's controlled
     by Twisted).
     """
-    pass
+    parsed = urlparse_cached(request)
+    path = urlunparse(('', '', parsed.path or '/', parsed.params, parsed.query, ''))
+    s = to_bytes(request.method) + b" " + to_bytes(path) + b" HTTP/1.1\r\n"
+    s += b"Host: " + to_bytes(parsed.hostname or b'') + b"\r\n"
+    if request.headers:
+        s += request.headers.to_string() + b"\r\n"
+    s += b"\r\n"
+    if request.body:
+        s += request.body
+    return s

 def referer_str(request: Request) -> Optional[str]:
     """Return Referer HTTP header suitable for logging."""
-    pass
+    referrer = request.headers.get('Referer')
+    if referrer:
+        return to_unicode(referrer)
+    return None

 def request_from_dict(d: dict, *, spider: Optional[Spider]=None) -> Request:
     """Create a :class:`~scrapy.Request` object from a dict.
@@ -142,11 +184,23 @@ def request_from_dict(d: dict, *, spider: Optional[Spider]=None) -> Request:
     If a spider is given, it will try to resolve the callbacks looking at the
     spider for methods with the same name.
     """
-    pass
+    d = d.copy()
+    callback = d.pop('callback', None)
+    errback = d.pop('errback', None)
+    cls = load_object(d.pop('cls')) if 'cls' in d else Request
+
+    if callback and spider:
+        d['callback'] = _get_method(spider, callback)
+    if errback and spider:
+        d['errback'] = _get_method(spider, errback)
+
+    return cls(**d)

 def _get_method(obj: Any, name: Any) -> Any:
     """Helper function for request_from_dict"""
-    pass
+    if isinstance(name, str):
+        return getattr(obj, name)
+    return name

 def request_to_curl(request: Request) -> str:
     """
@@ -155,4 +209,22 @@ def request_to_curl(request: Request) -> str:
     :param :class:`~scrapy.Request`: Request object to be converted
     :return: string containing the curl command
     """
-    pass
\ No newline at end of file
+    command = ["curl"]
+    command.append(request.url)
+
+    if request.method != 'GET':
+        command.extend(['-X', request.method])
+
+    for header_name, header_values in request.headers.items():
+        for header_value in header_values:
+            header = f'{header_name.decode("utf-8")}: {header_value.decode("utf-8")}'
+            command.extend(['-H', header])
+
+    if request.body:
+        if isinstance(request.body, str):
+            body = request.body
+        else:
+            body = request.body.decode('utf-8')
+        command.extend(['--data', body])
+
+    return ' '.join(f"'{x}'" if ' ' in x else x for x in command)
\ No newline at end of file
diff --git a/scrapy/utils/response.py b/scrapy/utils/response.py
index 2531e70a4..810d608b0 100644
--- a/scrapy/utils/response.py
+++ b/scrapy/utils/response.py
@@ -16,18 +16,41 @@ from scrapy.utils.decorators import deprecated
 from scrapy.utils.python import to_bytes, to_unicode
 _baseurl_cache: 'WeakKeyDictionary[Response, str]' = WeakKeyDictionary()

+def _remove_html_comments(text: str) -> str:
+    """Remove HTML comments from the given text."""
+    return re.sub('<!--.*?-->', '', text, flags=re.DOTALL)
+
 def get_base_url(response: 'scrapy.http.response.text.TextResponse') -> str:
     """Return the base url of the given response, joined with the response url"""
-    pass
+    if response not in _baseurl_cache:
+        text = response.text[0:4096]
+        text = _remove_html_comments(text)
+        match = re.search(r'<base\s+href\s*=\s*["\']?([^\s"\']+)', text, re.I)
+        base_url = match.group(1) if match else response.url
+        _baseurl_cache[response] = base_url
+    return _baseurl_cache[response]
 _metaref_cache: 'WeakKeyDictionary[Response, Union[Tuple[None, None], Tuple[float, str]]]' = WeakKeyDictionary()

 def get_meta_refresh(response: 'scrapy.http.response.text.TextResponse', ignore_tags: Iterable[str]=('script', 'noscript')) -> Union[Tuple[None, None], Tuple[float, str]]:
     """Parse the http-equiv refresh parameter from the given response"""
-    pass
+    if response not in _metaref_cache:
+        text = response.text[0:4096]
+        text = _remove_html_comments(text)
+        for tag in ignore_tags:
+            text = re.sub(f'<{tag}[\s>].*?</{tag}>', '', text, flags=re.DOTALL | re.IGNORECASE)
+        match = re.search(r'<meta[^>]*http-equiv[^>]*refresh[^>]*content\s*=\s*["\']?\s*(\d*)\s*;\s*url=([^"\'>\s]*)', text, re.IGNORECASE)
+        if match:
+            interval, url = match.groups()
+            _metaref_cache[response] = (float(interval), html.unescape(url))
+        else:
+            _metaref_cache[response] = (None, None)
+    return _metaref_cache[response]

 def response_status_message(status: Union[bytes, float, int, str]) -> str:
     """Return status code plus status text descriptive message"""
-    pass
+    status = int(status)
+    message = http.RESPONSES.get(status, "Unknown Status")
+    return f"{status} {to_unicode(message)}"

 @deprecated
 def response_httprepr(response: Response) -> bytes:
@@ -35,7 +58,16 @@ def response_httprepr(response: Response) -> bytes:
     is provided only for reference, since it's not the exact stream of bytes
     that was received (that's not exposed by Twisted).
     """
-    pass
+    values = [
+        b"HTTP/1.1 " + to_bytes(str(response.status)) + b" " + to_bytes(http.RESPONSES.get(response.status, b'')),
+    ]
+    if response.headers:
+        values.extend(
+            to_bytes(f"{k.decode('utf-8')}: {v[0].decode('utf-8')}") for k, v in response.headers.items()
+        )
+    values.append(b'')
+    values.append(response.body)
+    return b'\r\n'.join(values)

 def open_in_browser(response: Union['scrapy.http.response.html.HtmlResponse', 'scrapy.http.response.text.TextResponse'], _openfunc: Callable[[str], Any]=webbrowser.open) -> Any:
     """Open *response* in a local web browser, adjusting the `base tag`_ for
@@ -54,4 +86,27 @@ def open_in_browser(response: Union['scrapy.http.response.html.HtmlResponse', 's
             if "item name" not in response.body:
                 open_in_browser(response)
     """
-    pass
\ No newline at end of file
+    # Process response content
+    body = response.body
+    if isinstance(body, bytes):
+        body = body.decode('utf-8')
+
+    # Remove existing base tag if present
+    body = re.sub(r'<base\s+[^>]*>', '', body)
+
+    # Add our base tag
+    match = re.search(r'<head\b[^>]*>', body, re.IGNORECASE)
+    if match:
+        index = match.end()
+        body = body[:index] + f'<base href="{response.url}">' + body[index:]
+    else:
+        # If no <head> tag, just add it
+        body = f'<base href="{response.url}">\n' + body
+
+    # Create temporary file
+    fd, fname = tempfile.mkstemp('.html')
+    os.write(fd, body.encode('utf-8'))
+    os.close(fd)
+
+    # Open in browser
+    return _openfunc(f'file://{fname}')
\ No newline at end of file
diff --git a/scrapy/utils/spider.py b/scrapy/utils/spider.py
index 68e1a76e1..ecaad21a6 100644
--- a/scrapy/utils/spider.py
+++ b/scrapy/utils/spider.py
@@ -17,7 +17,14 @@ def iter_spider_classes(module: ModuleType) -> Generator[Type[Spider], Any, None
     """Return an iterator over all spider classes defined in the given module
     that can be instantiated (i.e. which have name)
     """
-    pass
+    for obj in vars(module).values():
+        if (
+            inspect.isclass(obj)
+            and issubclass(obj, Spider)
+            and obj.__module__ == module.__name__
+            and getattr(obj, 'name', None)
+        ):
+            yield obj

 def spidercls_for_request(spider_loader: SpiderLoader, request: Request, default_spidercls: Optional[Type[Spider]]=None, log_none: bool=False, log_multiple: bool=False) -> Optional[Type[Spider]]:
     """Return a spider class that handles the given Request.
@@ -30,7 +37,27 @@ def spidercls_for_request(spider_loader: SpiderLoader, request: Request, default
     default_spidercls passed. It can optionally log if multiple or no spiders
     are found.
     """
-    pass
+    snames = []
+    for name, spcls in spider_loader._spiders.items():
+        if spcls.handles_request(request):
+            snames.append(name)
+
+    if len(snames) == 0:
+        if log_none:
+            logger.warning('Unable to find spider that handles: %(request)s', {'request': request})
+        return default_spidercls
+    elif len(snames) > 1:
+        if log_multiple:
+            logger.warning('More than one spider can handle: %(request)s - %(snames)s', {'request': request, 'snames': ', '.join(snames)})
+        return default_spidercls
+    else:
+        return spider_loader.load(snames[0])

 class DefaultSpider(Spider):
-    name = 'default'
\ No newline at end of file
+    name = 'default'
+
+def iterate_spider_output(result: Any) -> Iterable[Any]:
+    """Iterate over a spider output, even if it is a deferred or coroutine."""
+    if isinstance(result, (Deferred, CoroutineType)):
+        result = deferred_from_coro(result)
+    return arg_to_iter(result)
\ No newline at end of file
diff --git a/scrapy/utils/ssl.py b/scrapy/utils/ssl.py
index 628e05da4..03fb628c2 100644
--- a/scrapy/utils/ssl.py
+++ b/scrapy/utils/ssl.py
@@ -3,4 +3,18 @@ import OpenSSL._util as pyOpenSSLutil
 import OpenSSL.SSL
 import OpenSSL.version
 from OpenSSL.crypto import X509Name
-from scrapy.utils.python import to_unicode
\ No newline at end of file
+from scrapy.utils.python import to_unicode
+
+def get_openssl_version():
+    """Return the OpenSSL version string."""
+    return OpenSSL.version.__version__
+
+def x509name_to_string(x509name: X509Name) -> str:
+    """Convert an X509Name object to a string."""
+    result = []
+    for name_entry in x509name:
+        field_name = pyOpenSSLutil.lib.OBJ_nid2sn(name_entry.get_object().nid)
+        field_name = to_unicode(field_name, errors='ignore')
+        field_value = to_unicode(name_entry.get_value(), errors='ignore')
+        result.append(f'{field_name}={field_value}')
+    return '/'.join(result)
\ No newline at end of file
diff --git a/scrapy/utils/template.py b/scrapy/utils/template.py
index 351f808e6..d590c776c 100644
--- a/scrapy/utils/template.py
+++ b/scrapy/utils/template.py
@@ -16,4 +16,11 @@ def string_camelcase(string: str) -> str:
     'MissingImages'

     """
-    pass
\ No newline at end of file
+    return ''.join(s.title() for s in CAMELCASE_INVALID_CHARS.split(string))
+
+def render_templatefile(path: Union[str, PathLike], **kwargs: Any) -> None:
+    """Render a template file using the given parameters"""
+    path = Path(path)
+    text = path.read_text()
+    text = string.Template(text).substitute(**kwargs)
+    path.write_text(text)
\ No newline at end of file
diff --git a/scrapy/utils/url.py b/scrapy/utils/url.py
index a6e4832de..018c8d0a1 100644
--- a/scrapy/utils/url.py
+++ b/scrapy/utils/url.py
@@ -15,23 +15,41 @@ if TYPE_CHECKING:
     from scrapy import Spider
 UrlT = Union[str, bytes, ParseResult]

+def _is_filesystem_path(url: str) -> bool:
+    """Return True if given URL appears to be a filesystem path."""
+    return bool(re.match(r'^[a-zA-Z]:[/\\]|^/[a-zA-Z0-9$_@.&+-]', url))
+
 def url_is_from_any_domain(url: UrlT, domains: Iterable[str]) -> bool:
     """Return True if the url belongs to any of the given domains"""
-    pass
+    host = parse_url(url).netloc.lower()
+    if not host:
+        return False
+    domains = [d.lower() for d in domains]
+    return any(host.endswith(d) for d in domains)

 def url_is_from_spider(url: UrlT, spider: Type['Spider']) -> bool:
     """Return True if the url belongs to the given spider"""
-    pass
+    return url_is_from_any_domain(url, getattr(spider, 'allowed_domains', []))

 def url_has_any_extension(url: UrlT, extensions: Iterable[str]) -> bool:
     """Return True if the url ends with one of the extensions provided"""
-    pass
+    url = cast(str, url)
+    if not isinstance(url, str):
+        url = url.url if isinstance(url, ParseResult) else to_unicode(url)
+    url, _ = urldefrag(url)  # remove fragments
+    path = urlparse(url).path
+    if not path:
+        return False
+    path = _unquotepath(path)
+    return any(path.endswith('.' + ext) for ext in extensions)

 def parse_url(url: UrlT, encoding: Optional[str]=None) -> ParseResult:
     """Return urlparsed url from the given argument (which could be an already
     parsed url)
     """
-    pass
+    if isinstance(url, ParseResult):
+        return url
+    return urlparse(to_unicode(url, encoding))

 def escape_ajax(url: str) -> str:
     """
@@ -56,16 +74,29 @@ def escape_ajax(url: str) -> str:
     >>> escape_ajax("www.example.com/ajax.html")
     'www.example.com/ajax.html'
     """
-    pass
+    defrag, frag = urldefrag(url)
+    if not frag.startswith('!'):
+        return url
+    return (defrag + ('&' if '?' in defrag else '?') +
+            '_escaped_fragment_=' + frag[1:])

 def add_http_if_no_scheme(url: str) -> str:
     """Add http as the default scheme if it is missing from the url."""
-    pass
+    match = re.match(r'^\w+://', url, re.I)
+    if not match:
+        url = 'http://' + url
+    return url

 def guess_scheme(url: str) -> str:
     """Add an URL scheme if missing: file:// for filepath-like input or
     http:// otherwise."""
-    pass
+    match = re.match(r'^\w+://', url, re.I)
+    if not match:
+        if _is_filesystem_path(url):
+            url = 'file://' + url
+        else:
+            url = 'http://' + url
+    return url

 def strip_url(url: str, strip_credentials: bool=True, strip_default_port: bool=True, origin_only: bool=False, strip_fragment: bool=True) -> str:
     """Strip URL string from some of its components:
@@ -77,4 +108,13 @@ def strip_url(url: str, strip_credentials: bool=True, strip_default_port: bool=T
       query and fragment components ; it also strips credentials
     - ``strip_fragment`` drops any #fragment component
     """
-    pass
\ No newline at end of file
+    if strip_credentials or origin_only:
+        url = re.sub(r'^([^:]+://)(?:[^/]*@)?(.*)$', r'\1\2', url)
+    if strip_default_port:
+        url = re.sub(r'^(https?://[^:/]+):80(?![0-9])', r'\1', url)
+        url = re.sub(r'^(https://[^:/]+):443(?![0-9])', r'\1', url)
+        url = re.sub(r'^(ftp://[^:/]+):21(?![0-9])', r'\1', url)
+    if origin_only:
+        url = re.sub(r'^([^:]+://[^/]+)(?:/.*)?', r'\1/', url)
+    if strip_fragment:
+        url = re.sub(r'#.*$', '', url)
\ No newline at end of file
diff --git a/scrapy/utils/versions.py b/scrapy/utils/versions.py
index c1945b11c..d7c8fcf62 100644
--- a/scrapy/utils/versions.py
+++ b/scrapy/utils/versions.py
@@ -8,4 +8,27 @@ import parsel
 import twisted
 import w3lib
 import scrapy
-from scrapy.utils.ssl import get_openssl_version
\ No newline at end of file
+from scrapy.utils.ssl import get_openssl_version
+
+def scrapy_components_versions() -> List[Tuple[str, str]]:
+    """Return a list of tuples containing the versions of the main Scrapy components."""
+    lxml_version = ".".join(map(str, lxml.etree.LXML_VERSION))
+    libxml2_version = ".".join(map(str, lxml.etree.LIBXML_VERSION))
+    try:
+        twisted_version = twisted.version.short()
+    except AttributeError:
+        twisted_version = twisted.__version__
+
+    return [
+        ("Scrapy", scrapy.__version__),
+        ("lxml", lxml_version),
+        ("libxml2", libxml2_version),
+        ("cssselect", cssselect.__version__),
+        ("parsel", parsel.__version__),
+        ("w3lib", w3lib.__version__),
+        ("Twisted", twisted_version),
+        ("Python", sys.version.split()[0]),
+        ("pyOpenSSL", get_openssl_version()),
+        ("cryptography", cryptography.__version__),
+        ("Platform", platform.platform()),
+    ]
\ No newline at end of file