CoreyMorris/MMLU-by-task-Leaderboard
16
1import pytest2import pandas as pd3import unittest4from result_data_processor import ResultDataProcessor5import os6 7class TestRegression(unittest.TestCase):8 def test_data_output_is_the_same(self):9 10 df_current = ResultDataProcessor().data11 12 # load the reference dataframe13 last_commit = os.popen('git rev-parse HEAD').read().strip()14 print(last_commit)15 reference_file = f'dataframe_history/output_{last_commit}.parquet'16 df_reference = pd.read_parquet(reference_file)17 18 #TODO19 # if there are no untracked changes, the dataframes should be the same20 # if there is no file saved for the current commit, save a file for the current commit21 # instead check the last commit to the one previous to that one22 # if there are untracked changes, the dataframes should be different23 # either optionally take a parameter for this test or extract the comparison logic so that it can be used separately to 24 # compare given any two commit hashes25 26 # Compare DataFrames, allowing for some tolerance in floating-point comparisons27 pd.testing.assert_frame_equal(df_current, df_reference, check_dtype=True, atol=1e-5)28 29 30if __name__ == '__main__':31 unittest.main()