def test_zs_close(): z = ZS(test_data_path("letters-none.zs")) z.close() for call in [[list, z.search()], [list, z.block_map(_check_raise_helper, AssertionError)], [list, z], [z.dump, BytesIO()], [z.validate], ]: print(repr(call)) assert_raises(ZSError, *call) # But calling .close() twice is fine. z.close() # smoke test for __del__ method ZS(test_data_path("letters-none.zs"))