def test_caching():
    vcf_fn = 'fixture/sample.vcf.gz'

    cache_fn = vcfnp.array._mk_cache_fn(vcf_fn, array_type='variants')
    debug(cache_fn)
    if os.path.exists(cache_fn):
        os.remove(cache_fn)
    a = variants(vcf_fn, cache=True, verbose=True)
    a2 = np.load(cache_fn)
    assert np.all(a == a2)

    cache_fn = vcfnp.array._mk_cache_fn(vcf_fn, array_type='calldata')
    debug(cache_fn)
    if os.path.exists(cache_fn):
        os.remove(cache_fn)
    a = calldata(vcf_fn, cache=True, verbose=True)
    a2 = np.load(cache_fn)
    assert np.all(a == a2)

    cache_fn = vcfnp.array._mk_cache_fn(vcf_fn, array_type='calldata_2d')
    debug(cache_fn)
    if os.path.exists(cache_fn):
        os.remove(cache_fn)
    a = calldata_2d(vcf_fn, cache=True, verbose=True)
    a2 = np.load(cache_fn)
    assert np.all(a == a2)
dataset/ETHPy150Open alimanfoo/vcfnp/vcfnp/test/test_array.py/test_caching/original