<commit_before>import unittest
import tempfile
import os
import sys
file_dir = os.path.dirname(os.path.realpath(__file__))
goal_dir = os.path.join(file_dir, "../")
proj_root = os.path.abspath(goal_dir)+'/'
sys.path.append(proj_root + 'bin/')
import gsm_lib
import utils.SimpleConfigParser as SimpleConfigParser

class TestReadConfig(unittest.TestCase):

    def setUp(self):
        self.setupFolder = tempfile.mkdtemp() + "/"
        self.setupFile = "settings.ini"
        self.input = """smtp_host_for_outbound_mail = smtp.example.org
system_log_file = log/rsm.log
source_data_schema_file = source_data_schema.xml
site_catalog = site-catalog.xml
redcap_uri = https://example.org/redcap/api/
token = ABCDEF878D219CFA5D3ADF7F9AB12345"""
        self.setupFileFullPath = self.setupFolder + self.setupFile
        f = open(self.setupFileFullPath, 'w')
        f.write(self.input)
        
        f.close()
        self.files = ['source_data_schema.xml', 'site-catalog.xml']
        for file in self.files:
            try:
                f = open(self.setupFolder+file, "w+")
            except:
                print("setUp failed to create file '" + file + "'")

    def test_readConfig(self):
        settings = SimpleConfigParser.SimpleConfigParser()
        settings.read(self.setupFileFullPath)
        settings.set_attributes()
        gsm_lib.read_config(self.setupFolder,self.setupFile, settings)
        self.assertEqual(settings.system_log_file, "log/rsm.log")
        self.assertEqual(settings.source_data_schema_file,
            "source_data_schema.xml")
        self.assertEqual(settings.site_catalog, "site-catalog.xml")
        self.assertEqual(settings.redcap_uri,
            "https://example.org/redcap/api/")
        self.assertEqual(settings.token,
            "ABCDEF878D219CFA5D3ADF7F9AB12345")
        self.assertEqual(settings.smtp_host_for_outbound_mail,
            "smtp.example.org")

    def tearDown(self):
        os.unlink(self.setupFileFullPath)
        for file in self.files:
            try:
                os.unlink(self.setupFolder+file)
            except:
                print("setUp failed to unlink file '" + file + "'")

        return()

if __name__ == '__main__':
    unittest.main()<commit_msg>fix test case broken by commit <PASSWORD><commit_after>import unittest
import tempfile
import os
import sys
file_dir = os.path.dirname(os.path.realpath(__file__))
goal_dir = os.path.join(file_dir, "../")
proj_root = os.path.abspath(goal_dir)+'/'
sys.path.append(proj_root + 'bin/')
import gsm_lib
import utils.SimpleConfigParser as SimpleConfigParser

class TestReadConfig(unittest.TestCase):

    def setUp(self):
        self.setupFolder = tempfile.mkdtemp() + "/"
        self.setupFile = "settings.ini"
        self.input = """system_log_file = log/rsm.log
source_data_schema_file = source_data_schema.xml
site_catalog = site-catalog.xml
sender_email = <EMAIL>"""
        self.setupFileFullPath = self.setupFolder + self.setupFile
        f = open(self.setupFileFullPath, 'w')
        f.write(self.input)
        
        f.close()
        self.files = ['source_data_schema.xml', 'site-catalog.xml']
        for file in self.files:
            try:
                f = open(self.setupFolder+file, "w+")
            except:
                print("setUp failed to create file '" + file + "'")

    def test_readConfig(self):
        settings = SimpleConfigParser.SimpleConfigParser()
        settings.read(self.setupFileFullPath)
        settings.set_attributes()
        gsm_lib.read_config(self.setupFolder,self.setupFile, settings)
        self.assertEqual(settings.system_log_file, "log/rsm.log")
        self.assertEqual(settings.source_data_schema_file,
            "source_data_schema.xml")
        self.assertEqual(settings.site_catalog, "site-catalog.xml")        

    def tearDown(self):
        os.unlink(self.setupFileFullPath)
        for file in self.files:
            try:
                os.unlink(self.setupFolder+file)
            except:
                print("setUp failed to unlink file '" + file + "'")

        return()

if __name__ == '__main__':
    unittest.main()
{'fraction_non_alphanumeric': 0.11524522831601836, 'fraction_numerical': 0.00724812756704518, 'mean_word_length': 2.733092876465284, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 12}, '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}}
{'dir': 'git-commits-cleaned', 'id': '2935847', 'n_tokens_mistral': 1320, 'n_tokens_neox': 1277, 'n_words': 215}