File size: 1,556 Bytes
ee9e25e
 
 
513e813
 
ee9e25e
 
 
 
 
 
 
 
 
 
 
 
513e813
83a34f0
513e813
 
 
83a34f0
 
 
 
 
 
 
 
c32735e
 
 
 
 
 
 
 
30fa96a
c32735e
30fa96a
 
c32735e
 
ee9e25e
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import unittest
from details_data_processor import DetailsDataProcessor
import pandas as pd
import requests
import os

class TestDetailsDataProcessor(unittest.TestCase):

    def setUp(self):
        self.processor = DetailsDataProcessor()

    # check that the result is a pandas dataframe
    def test_process_data(self):
        pass
        # data = self.processor.data
        # self.assertIsInstance(data, pd.DataFrame)

    def test_download_file(self):
        DetailsDataProcessor.download_file('https://www.google.com', 'test.html')
        self.assertTrue(os.path.exists('test.html'))
        os.remove('test.html')

    def test_generate_url(self):
        results_file_path = "64bits/LexPodLM-13B/results_2023-07-25T13:41:51.227672.json"
        expected_url = 'https://huggingface.co/datasets/open-llm-leaderboard/details/resolve/main/64bits/LexPodLM-13B/details_harness%7ChendrycksTest-moral_scenarios%7C5_2023-07-25T13%3A41%3A51.227672.json'


        constructed_url = self.processor.generate_url(results_file_path)
        self.assertEqual(expected_url, constructed_url)

    def test_pipeline(self):
        df = self.processor.pipeline()
        print(100 * "****")
        print(df)
        self.assertIsInstance(df, pd.DataFrame)

    def test_find_files(self):
        directory = 'results'
        pattern = 'results*.json'
        files = self.processor._find_files(directory, pattern)
        # breakpoint()
        # print(files)
        self.assertIsInstance(files, list)

        
if __name__ == '__main__':
    unittest.main()