<jupyter_start><jupyter_text>find a way to copy existing hdf5 files and give them a new name for testing<jupyter_code>from shutil import copyfile
from ramandecompy import dataprep
copyfile('ramandecompy/tests/test_files/test_experiment.hdf5', 'copy.hdf5')
dataprep.view_hdf5('copy.hdf5')
import os
import h5py
from shutil import copyfile

def test_superimpose_next():
    """
    docstring
    """
    # initialize inputs
    hdf5_filename = 'test_experiement_copy.hdf5'
    existing_key = '<KEY>'
    new_key = '<KEY>'
    # create a copy of test_experiment.hdf5
    copyfile('ramandecompy/tests/test_files/test_experiment.hdf5', hdf5_filename)
    # run function
    spectrafit.superimpose_next(hdf5_filename, existing_key, new_key, plot_fits=True)
    try:
        spectrafit.superimpose_next(4.2, existing_key, new_key, plot_fits=True)
    except TypeError:
        print('A float was passed to the function, and was handled well with a TypeError.')
    try:
        spectrafit.superimpose_next(hdf5_filename, [1, 2], new_key, plot_fits=True)
    except TypeError:
        print('A list was passed to the function, and was handled well with a TypeError.')
    try:
        spectrafit.superimpose_next(hdf5_filename, existing_key, 4, plot_fits=True)
    except TypeError:
        print('An int was passed to the function, and was handled well with a TypeError.')
    try:
        spectrafit.superimpose_next(hdf5_filename, existing_key, new_key, plot_fits='yes')
    except TypeError:
        print('A string was passed to the function, and was handled well with a TypeError.')
    os.remove(hdf5_filename)
test_superimpose_next()
test = ['blah', 'blah2', 'blah4']
if not'blah3' in test:
    raise TypeError
def test_superimpose_set():
    """
    docstring
    """
    # initialize inputs
    hdf5_filename = 'test_experiement_copy.hdf5'
    target_key = '<KEY>'
    # create a copy of test_experiment.hdf5
    copyfile('ramandecompy/tests/test_files/test_experiment.hdf5', hdf5_filename)
    # run function
    spectrafit.superimpose_set(hdf5_filename, target_key, plot_fits=True)
    try:
        spectrafit.superimpose_set(4.2, target_key, plot_fits=True)
    except TypeError:
        print('A float was passed to the function, and was handled well with a TypeError.')
    try:
        spectrafit.superimpose_set(hdf5_filename, 7, plot_fits=True)
    except TypeError:
        print('An int was passed to the function, and was handled well with a TypeError.')
    try:
        spectrafit.superimpose_set(hdf5_filename, '420C/25s', plot_fits=True)
    except KeyError:
        print('An invalid key was passed to the function, and was handled well with a KeyError.')
    try:
        spectrafit.superimpose_set(hdf5_filename, target_key, plot_fits=(1, 'foo'))
    except TypeError:
        print('A tuple was passed to the function, and was handled well with a TypeError.')
    os.remove(hdf5_filename)
test_superimpose_set()
hdf5_filename = 'test_experiement_copy.hdf5'
target_key = '<KEY>'
# create a copy of test_experiment.hdf5
copyfile('ramandecompy/tests/test_files/test_experiment.hdf5', hdf5_filename)
hdf5 = h5py.File(hdf5_filename, 'r')
target_key = '<KEY>'
if target_key in list(hdf5.keys()) == False:
    raise KeyError("""Passed value of `target_key` is not
    a valid key for {}""".format(hdf5_filename))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09475566150178784, 'fraction_numerical': 0.015792610250297975, 'mean_word_length': 4.0633484162895925, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '416907', 'license': 'MIT', 'n_tokens_mistral': 1154, 'n_tokens_neox': 1137, 'n_words': 293, 'path': 'development/Spectrafit_tests.ipynb', 'repo_name': 'kernb2/raman-spectra-decomp-analysis', 'size': '3371'}