<commit_before>import unittest

import io


class test_LoadFile(unittest.TestCase):

    def test_loadFile_filenameType(self):
        with self.assertRaises(TypeError):
            io.loadFile(42, indexCol=0)

    def test_loadFile_indexColType(self):
        with self.assertRaises(TypeError):
            io.loadFile('examples/metadata.tab', indexCol='1')

    def test_loadFile_verboseType(self):
        with self.assertRaises(TypeError):
            io.loadFile('filename', verbose=42)

    def test_loadFile_nonExistentFile(self):
        with self.assertRaises(IOError):
            io.loadFile('file_does_not_exist', indexCol=0)

    def test_loadFile_directoryNotFile(self):
        with self.assertRaises(IOError):
            io.loadFile('examples', indexCol=0)


class test_defaultSampleNameExtractionFunction(unittest.TestCase):

    def test_defaultSampleNameExtractionFunction_value(self):
        self.assertEquals(
            io.defaultSampleNameExtractionFunction(
                'Methane_oxidation_as_a_community_function__' +
                'defining_partnerships_and_strategies_through_' +
                'sequencing_metagenomes_and_metatranscriptomes_of_' +
                'laboratory_manipulated_microcosms__Lake_Washington' +
                '_sediment_Metagenome_7_HOW4_[LakWasMeta7_HOW4]'
            ),
            'mg7H_4'
        )
        self.assertEquals(
            io.defaultSampleNameExtractionFunction(
                'Methane_oxidation_as_a_community_function__' +
                'defining_partnerships_and_strategies_through_' +
                'sequencing_metagenomes_and_metatranscriptomes_of_' +
                'laboratory_manipulated_microcosms__Lake_Washington' +
                '_sediment_Metatranscriptome_7_HOW4_[LakWasMeta7_HOW4]'
            ),
            'mt7H_4'
        )

    def test_defaultSampleNameExtractionFunction_invalid(self):
        with self.assertRaises(ValueError):
            io.defaultSampleNameExtractionFunction('invalid')
<commit_msg>fixed indexCol argument handling in tests<commit_after>import unittest

import io


class test_LoadFile(unittest.TestCase):

    def test_loadFile_filenameType(self):
        with self.assertRaises(TypeError):
            io.loadFile(42, indexCols=[0])

    def test_loadFile_indexColType(self):
        with self.assertRaises(TypeError):
            io.loadFile(
                'examples/metadata.tab',
                indexCols=0
                )

    def test_loadFile_verboseType(self):
        with self.assertRaises(TypeError):
            io.loadFile('filename', verbose=42)

    def test_loadFile_nonExistentFile(self):
        with self.assertRaises(IOError):
            io.loadFile('file_does_not_exist', indexCols=[0])

    def test_loadFile_directoryNotFile(self):
        with self.assertRaises(IOError):
            io.loadFile('examples', indexCols=[0])


class test_defaultSampleNameExtractionFunction(unittest.TestCase):

    def test_defaultSampleNameExtractionFunction_value(self):
        self.assertEquals(
            io.defaultSampleNameExtractionFunction(
                'Methane_oxidation_as_a_community_function__' +
                'defining_partnerships_and_strategies_through_' +
                'sequencing_metagenomes_and_metatranscriptomes_of_' +
                'laboratory_manipulated_microcosms__Lake_Washington' +
                '_sediment_Metagenome_7_HOW4_[LakWasMeta7_HOW4]'
            ),
            'mg7H_4'
        )
        self.assertEquals(
            io.defaultSampleNameExtractionFunction(
                'Methane_oxidation_as_a_community_function__' +
                'defining_partnerships_and_strategies_through_' +
                'sequencing_metagenomes_and_metatranscriptomes_of_' +
                'laboratory_manipulated_microcosms__Lake_Washington' +
                '_sediment_Metatranscriptome_7_HOW4_[LakWasMeta7_HOW4]'
            ),
            'mt7H_4'
        )

    def test_defaultSampleNameExtractionFunction_invalid(self):
        with self.assertRaises(ValueError):
            io.defaultSampleNameExtractionFunction('invalid')

{'fraction_non_alphanumeric': 0.07278020378457059, 'fraction_numerical': 0.009704027171276079, 'mean_word_length': 2.7825688073394494, 'pattern_counts': {'":': 0, '<': 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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2591771', 'n_tokens_mistral': 1283, 'n_tokens_neox': 1199, 'n_words': 128}