Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(4)  |  Call(3)  |  Derive(0)  |  Import(1)
Replace attribute in object while in context mode.

            @wraps(func)
    def helper(*args, **kwds):
        return GeneratorContextManager(func(*args, **kwds))
        


src/t/i/tinydav-0.7.3/test/TestTinyDAV.py   tinydav(Download)
from tinydav import WebDAVLockResponse
from tinydav import MultiStatusResponse
from Mock import injected, replaced
import Mock
 
        response.content = MULTISTATUS
        response.status = 207
        with replaced(WebDAVResponse, _parse_xml_content=Mock.omnivore_func()):
            davresponse = WebDAVResponse(response)
        davresponse._parse_xml_content()
        response.content = MULTISTATUS_BROKEN
        response.status = 207
        with replaced(WebDAVResponse, _parse_xml_content=Mock.omnivore_func()):
            davresponse = WebDAVResponse(response)
        davresponse._parse_xml_content()
        davresponse = WebDAVResponse(response)
        mockparser = Mock.Omnivore()
        with replaced(davresponse, _parse_xml_content=mockparser):
            self.assertFalse(davresponse.is_multistatus)
            self.assertEquals(len(mockparser.called["__call__"]), 0)