'Test Response.replace() method'

def test_replace(self):

    hdrs = Headers({'key': 'value'})
    r1 = self.response_class('http://www.example.com')
    r2 = r1.replace(status=301, body='New    body', headers=hdrs)
    assert (r1.body == '')
    self.assertEqual(r1.url, r2.url)
    self.assertEqual((r1.status, r2.status), (200, 301))
    self.assertEqual((r1.body, r2.body), ('', 'New    body'))
    self.assertEqual((r1.headers, r2.headers), ({}, hdrs))
    r3 = self.response_class('http://www.example.com', flags=['cached'])
    r4 = r3.replace(body='', flags=[])
    self.assertEqual(r4.body, '')
    self.assertEqual(r4.flags, [])
