<commit_before>import os
from ast import literal_eval
import pandas as pd
import pytest
from pylhc import BSRT_analysis

INPUTS = os.path.join('..', 'inputs', 'bsrt_analysis')


def test_bsrt_df(_bsrt_df):
    results = BSRT_analysis.main(directory=INPUTS, beam='B1')
    pd.testing.assert_frame_equal(results['bsrt_df'], _bsrt_df)


@pytest.mark.mpl_image_compare
def test_fitvarplot(_bsrt_df):
    return BSRT_analysis.plot_fit_variables({'show_plots': False, 'outputdir': None}, _bsrt_df)


@pytest.mark.mpl_image_compare
def test_fullcrossection(_bsrt_df):
    return BSRT_analysis.plot_full_crosssection({'show_plots': False, 'outputdir': None}, _bsrt_df)


@pytest.mark.mpl_image_compare
def test_auxiliary_variables(_bsrt_df):
    return BSRT_analysis.plot_auxiliary_variables({'show_plots': False, 'outputdir': None}, _bsrt_df)


@pytest.fixture()
def _bsrt_df():
    return pd.read_csv(os.path.join(INPUTS, BSRT_analysis._get_bsrt_tfs_fname('B1')),
                       parse_dates=True,
                       index_col='TimeIndex',
                       quotechar='"',
                       converters={"acquiredImageRectangle": literal_eval,
                                   "beam": literal_eval,
                                   "gateMode": literal_eval,
                                   "imageSet": literal_eval,
                                   "lastFitResults": literal_eval,
                                   "projDataSet1": literal_eval,
                                   "projDataSet2": literal_eval,
                                   "projPositionSet1": literal_eval,
                                   "projPositionSet2": literal_eval
                                   }
                                   )
<commit_msg>fixed path for test file<commit_after>import os
from ast import literal_eval
import pandas as pd
import pytest
from pylhc import BSRT_analysis

CURRENT_DIR = os.path.dirname(__file__)

INPUTS = os.path.join(CURRENT_DIR, os.pardir, 'inputs', 'bsrt_analysis')


def test_bsrt_df(_bsrt_df):
    results = BSRT_analysis.main(directory=INPUTS, beam='B1')
    pd.testing.assert_frame_equal(results['bsrt_df'], _bsrt_df)


@pytest.mark.mpl_image_compare
def test_fitvarplot(_bsrt_df):
    return BSRT_analysis.plot_fit_variables({'show_plots': False, 'outputdir': None}, _bsrt_df)


@pytest.mark.mpl_image_compare
def test_fullcrossection(_bsrt_df):
    return BSRT_analysis.plot_full_crosssection({'show_plots': False, 'outputdir': None}, _bsrt_df)


@pytest.mark.mpl_image_compare
def test_auxiliary_variables(_bsrt_df):
    return BSRT_analysis.plot_auxiliary_variables({'show_plots': False, 'outputdir': None}, _bsrt_df)


@pytest.fixture()
def _bsrt_df():
    return pd.read_csv(os.path.join(INPUTS, BSRT_analysis._get_bsrt_tfs_fname('B1')),
                       parse_dates=True,
                       index_col='TimeIndex',
                       quotechar='"',
                       converters={"acquiredImageRectangle": literal_eval,
                                   "beam": literal_eval,
                                   "gateMode": literal_eval,
                                   "imageSet": literal_eval,
                                   "lastFitResults": literal_eval,
                                   "projDataSet1": literal_eval,
                                   "projDataSet2": literal_eval,
                                   "projPositionSet1": literal_eval,
                                   "projPositionSet2": literal_eval
                                   }
                                   )

{'fraction_non_alphanumeric': 0.09347098214285714, 'fraction_numerical': 0.0033482142857142855, 'mean_word_length': 2.045879354290569, 'pattern_counts': {'":': 18, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3082390', 'n_tokens_mistral': 1087, 'n_tokens_neox': 1033, 'n_words': 169}