def METHOD_NAME(self):
    """Parser method is removed or replaced dynamically."""
    class MySpider(Spider):
        name = "my_spider"
        def parse(self, response):
            pass
    spider = MySpider()
    r = Request("http://www.example.com", callback=spider.parse)
    setattr(spider, "parse", None)
    self.assertRaises(ValueError, r.to_dict, spider=spider)