<commit_before>from unittest import TestCase
from ddsc.core.ignorefile import FileFilter, FilenamePatternList, IgnoreFilePatterns
from mock import patch, Mock, mock_open, call, MagicMock
from ddsc.config import FILE_EXCLUDE_REGEX_DEFAULT


class TestFileFilter(TestCase):
    def test_default_file_exclude_regex(self):
        include_file = FileFilter(FILE_EXCLUDE_REGEX_DEFAULT).include
        good_files = [
            'data.txt',
            'long file with many words and stuff 2000.csv',
            '.gitignore',
            '.ddsclient_other',
            '.DS_Storeage',
            'DS_Store'
        ]
        bad_files = [
            '.ddsclient',
            '.DS_Store',
            '._anything',
            '._abc'
        ]
        # include good filenames
        for good_filename in good_files:
            self.assertEqual(include_file(good_filename, is_file=True), True)
        # exclude bad filenames
        for bad_filename in bad_files:
            self.assertEqual(include_file(bad_filename, is_file=True), False)


class FilenamePatternListTests(TestCase):
    def test_add_filename_pattern(self):<commit_msg>remove unused Mock for flake8<commit_after>from unittest import TestCase
from ddsc.core.ignorefile import FileFilter, FilenamePatternList, IgnoreFilePatterns
from mock import patch, mock_open, call, MagicMock
from ddsc.config import FILE_EXCLUDE_REGEX_DEFAULT


class TestFileFilter(TestCase):
    def test_default_file_exclude_regex(self):
        include_file = FileFilter(FILE_EXCLUDE_REGEX_DEFAULT).include
        good_files = [
            'data.txt',
            'long file with many words and stuff 2000.csv',
            '.gitignore',
            '.ddsclient_other',
            '.DS_Storeage',
            'DS_Store'
        ]
        bad_files = [
            '.ddsclient',
            '.DS_Store',
            '._anything',
            '._abc'
        ]
        # include good filenames
        for good_filename in good_files:
            self.assertEqual(include_file(good_filename, is_file=True), True)
        # exclude bad filenames
        for bad_filename in bad_files:
            self.assertEqual(include_file(bad_filename, is_file=True), False)


class FilenamePatternListTests(TestCase):
    def test_add_filename_pattern(self):
{'fraction_non_alphanumeric': 0.07897033158813263, 'fraction_numerical': 0.003926701570680628, 'mean_word_length': 2.5385802469135803, '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': '3084573', 'n_tokens_mistral': 661, 'n_tokens_neox': 636, 'n_words': 144}