def test_simple(self): rm = rand(100, 1000, 0.05).tocsc() fd, filename = tempfile.mkstemp(suffix="rb") try: hb_write(filename, rm, HBInfo.from_data(rm)) m = hb_read(filename) finally: os.close(fd) os.remove(filename) assert_csc_almost_equal(m, rm)
def check_save_load(self, value): with tempfile.NamedTemporaryFile(mode='w+t') as file: hb_write(file, value) file.file.seek(0) value_loaded = hb_read(file) assert_csc_almost_equal(value, value_loaded)