<commit_before>import tempfile
import unittest
import os
from nimoy.runner.spec_finder import SpecFinder


class TestSpecFinder(unittest.TestCase):
    def setUp(self):
        self.temp_spec = tempfile.NamedTemporaryFile(suffix='_spec.py')

    def tearDown(self):
        os.remove(self.temp_spec.name)

    def test_implicit_location(self):
        spec_locations = SpecFinder(os.path.dirname(self.temp_spec.name)).find([])
        self.assertEquals(len(spec_locations), 1)
        self.assertRegex(spec_locations[0], self.temp_spec.name)

    def test_explicit_spec_path(self):
        spec_locations = SpecFinder('/some/working/dir').find([self.temp_spec.name])
        self.assertEquals(len(spec_locations), 1)
        self.assertRegex(spec_locations[0], self.temp_spec.name)

    def test_explicit_spec_directory(self):
        spec_locations = SpecFinder('/some/working/dir').find([os.path.dirname(self.temp_spec.name)])
        self.assertEquals(len(spec_locations), 1)
        self.assertRegex(spec_locations[0], self.temp_spec.name)

    def test_relative_spec_path(self):
        spec_locations = SpecFinder('/some/working/dir').find(['jim_spec.py'])
        self.assertEquals(len(spec_locations), 1)
        self.assertRegex(spec_locations[0], '/some/working/dir/jim_spec.py')<commit_msg>Remove the code cleans up the temp file as temp files are already automatically cleaned<commit_after>import os
import tempfile
import unittest

from nimoy.runner.spec_finder import SpecFinder


class TestSpecFinder(unittest.TestCase):
    def setUp(self):
        self.temp_spec = tempfile.NamedTemporaryFile(suffix='_spec.py')

    def test_implicit_location(self):
        spec_locations = SpecFinder(os.path.dirname(self.temp_spec.name)).find([])
        self.assertEquals(len(spec_locations), 1)
        self.assertRegex(spec_locations[0], self.temp_spec.name)

    def test_explicit_spec_path(self):
        spec_locations = SpecFinder('/some/working/dir').find([self.temp_spec.name])
        self.assertEquals(len(spec_locations), 1)
        self.assertRegex(spec_locations[0], self.temp_spec.name)

    def test_explicit_spec_directory(self):
        spec_locations = SpecFinder('/some/working/dir').find([os.path.dirname(self.temp_spec.name)])
        self.assertEquals(len(spec_locations), 1)
        self.assertRegex(spec_locations[0], self.temp_spec.name)

    def test_relative_spec_path(self):
        spec_locations = SpecFinder('/some/working/dir').find(['jim_spec.py'])
        self.assertEquals(len(spec_locations), 1)
        self.assertRegex(spec_locations[0], '/some/working/dir/jim_spec.py')
{'fraction_non_alphanumeric': 0.12399540757749714, 'fraction_numerical': 0.006123230003827019, 'mean_word_length': 4.259557344064386, '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': '6256494', 'n_tokens_mistral': 846, 'n_tokens_neox': 809, 'n_words': 112}