<commit_before>#
# Unit tests for the viewer.git module.
#
# Copyright: (c) 2014 by <NAME> <<EMAIL>> and contributors
# License: BSD, see LICENSE for more details
#

import subprocess
import unittest
from unittest import mock

from viewer.git import Git
from viewer.git import GitCmdError
from viewer.git import GitBinaryNotFoundError


class GitTests(unittest.TestCase):
    """A base class for all git tests."""

    def setUp(self):
        # Patch os.chdir.
        patcher = mock.patch('os.chdir')
        self.addCleanup(patcher.stop)
        self.mock_chdir = patcher.start()

        # Patch subprocess.check_output.
        patcher = mock.patch('subprocess.check_output')
        self.addCleanup(patcher.stop)
        self.mock_check_output = patcher.start()<commit_msg>test_git: Fix the order of imports.<commit_after>#
# Unit tests for the viewer.git module.
#
# Copyright: (c) 2014 by <NAME> <<EMAIL>> and contributors
# License: BSD, see LICENSE for more details
#

import subprocess
import unittest
from unittest import mock

from viewer.git import Git
from viewer.git import GitBinaryNotFoundError
from viewer.git import GitCmdError


class GitTests(unittest.TestCase):
    """A base class for all git tests."""

    def setUp(self):
        # Patch os.chdir.
        patcher = mock.patch('os.chdir')
        self.addCleanup(patcher.stop)
        self.mock_chdir = patcher.start()

        # Patch subprocess.check_output.
        patcher = mock.patch('subprocess.check_output')
        self.addCleanup(patcher.stop)
        self.mock_check_output = patcher.start()
{'fraction_non_alphanumeric': 0.09873417721518987, 'fraction_numerical': 0.005063291139240506, 'mean_word_length': 3.355371900826446, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '186035', 'n_tokens_mistral': 495, 'n_tokens_neox': 460, 'n_words': 138}