# Path: tests/data.py



import blimpy as bl
import pytest
from tests.data import voyager_fil, voyager_h5, here
    from blimpy.io.file_wrapper import open_file
    from blimpy.io.file_wrapper import open_file
    from blimpy.io.file_wrapper import open_file
    h5r._init_empty_selection()
    
    # perform reading again and we make sure that
    # the user-facing functions survive

    h5r.populate_freqs()
    
    # just arbitrary values
    h5r.calc_n_blobs(300)
    h5r.read_blob((300, 300, 300, 300))

    h5r.calc_n_coarse_chan()
    h5r.calc_n_coarse_chan(1)
    # we have at least 2 if branches that we are not exploring

def test_file_wrapper_open_fil_file():
    filr = open_file(voyager_fil)
    
    filr.calc_n_blobs(300)
    filr.read_blob((300, 300, 300, 300))

def test_invalid_files():
    
    # script should error-out if file does not exist
    with pytest.raises(IOError):
        open_file(here + 'file_does_not_exist.h5')

    # script should error-out if file is not a
    # valid blimpy data file
    with pytest.raises(NotImplementedError):

# Path: tests/data.py



# Path: tests/test_file_wrapper.py
import blimpy as bl
import pytest
from tests.data import voyager_fil, voyager_h5, here
    from blimpy.io.file_wrapper import open_file
    from blimpy.io.file_wrapper import open_file
    from blimpy.io.file_wrapper import open_file

    h5r._init_empty_selection()
    
    # perform reading again and we make sure that
    # the user-facing functions survive

    h5r.populate_freqs()
    
    # just arbitrary values
    h5r.calc_n_blobs(300)
    h5r.read_blob((300, 300, 300, 300))

    h5r.calc_n_coarse_chan()
    h5r.calc_n_coarse_chan(1)
    # we have at least 2 if branches that we are not exploring

def test_file_wrapper_open_fil_file():
    filr = open_file(voyager_fil)
    
    filr.calc_n_blobs(300)
    filr.read_blob((300, 300, 300, 300))

def test_invalid_files():
    
    # script should error-out if file does not exist
    with pytest.raises(IOError):
        open_file(here + 'file_does_not_exist.h5')

    # script should error-out if file is not a
    # valid blimpy data file
    with pytest.raises(NotImplementedError):

        open_file(here + '/run_tests.sh')