<commit_before>#!/usr/bin/python

import unittest

import sys
import os
sys.path.append(os.path.join('..', '.'))

from wee_slack import *

from mock import MagicMock
from mock import Mock

class FooTest(unittest.TestCase):
    def setUp(self):
        global w
        w = MagicMock()
        #w.color =
        w.color.return_value = 3

        self.something = {}
        self.something2 = {}
        self.something['items'] = SearchList(['a','b','c'])
        self.something2['items'] = SearchList(['a','d','e'])
        self.my_list = SearchList([self.something, self.something2])
        self.meta_list = Meta('items', self.my_list)

    def test_searchlist_find_one_element(self):
        self.assertEqual(self.meta_list.find('a'), 'a')

    def test_searchlist_find_duplicate_elements(self):
        self.something['items'].append('a')
        self.assertEqual(self.meta_list.find('a'), 'a')

    def test_metasearchlist_findfirst_duplicate_elements(self):
        self.assertEqual(w.color('1234','1234'), 3)
        pass
#        print str(self.meta_list)
#        self.assertEqual(self.meta_list.find_first('a'), 'a')

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


<commit_msg>don't write bytecode when testing<commit_after>#!/usr/bin/python



import unittest

import sys
sys.dont_write_bytecode = True
import os
sys.path.append(os.path.join('..', '.'))

from wee_slack import *

from mock import MagicMock
from mock import Mock

class FooTest(unittest.TestCase):
    def setUp(self):
        global w
        w = MagicMock()
        #w.color =
        w.color.return_value = 3

        self.something = {}
        self.something2 = {}
        self.something['items'] = SearchList(['a','b','c'])
        self.something2['items'] = SearchList(['a','d','e'])
        self.my_list = SearchList([self.something, self.something2])
        self.meta_list = Meta('items', self.my_list)

    def test_searchlist_find_one_element(self):
        self.assertEqual(self.meta_list.find('a'), 'a')

    def test_searchlist_find_duplicate_elements(self):
        self.something['items'].append('a')
        self.assertEqual(self.meta_list.find('a'), 'a')

    def test_metasearchlist_findfirst_duplicate_elements(self):
        self.assertEqual(w.color('1234','1234'), 3)
        pass
#        print str(self.meta_list)
#        self.assertEqual(self.meta_list.find_first('a'), 'a')

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



{'fraction_non_alphanumeric': 0.15096668037844507, 'fraction_numerical': 0.0106951871657754, 'mean_word_length': 3.2003454231433506, 'pattern_counts': {'":': 2, '<': 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': '4085887', 'n_tokens_mistral': 814, 'n_tokens_neox': 781, 'n_words': 134}