def test_slow_async_opening(self): # This test relies on the fact that file opening takes longer than the # assertions tested immediately after the open_async() call. It seems # to work well even with the small gzip or bzip2 files, but we use a # much larger gzip file to make sure. future = mrcfile.open_async(self.slow_mrc_name) assert future.running() assert not future.done() with future.result() as mrc: assert future.done() assert not future.running() assert repr(mrc) == ("GzipMrcFile('{0}', mode='r')".format( self.slow_mrc_name)) assert future.exception() is None
def test_simple_async_opening(self): with mrcfile.open_async(self.example_mrc_name).result() as mrc: assert repr(mrc) == ("MrcFile('{0}', mode='r')".format( self.example_mrc_name))