<commit_before>import unittest

from unittest import mock
from unittest.mock import patch

from app.service import user_service

user_repository_mock = mock.MagicMock()


@patch.object(user_service, 'user_repository', user_repository_mock)
class TestAlvService(unittest.TestCase):

    def setUp(self):
        user_repository_mock.reset_mock()

    def test_find_by_id(self):
        user_id = 1
        user_repository_mock.find_by_id.return_value = user_id

        a = user_service.find_by_id(user_id)

        self.assertEqual(a, user_id)
        user_repository_mock.find_by_id.assert_called_once()
        user_repository_mock.find_by_id.assert_called_with(1)

    def test_find_members():
        user_service.find_members()

        user_repository_mock.find_members.assert_called_once()<commit_msg>Added self to test user find members.<commit_after>import unittest

from unittest import mock
from unittest.mock import patch

from app.service import user_service

user_repository_mock = mock.MagicMock()


@patch.object(user_service, 'user_repository', user_repository_mock)
class TestAlvService(unittest.TestCase):

    def setUp(self):
        user_repository_mock.reset_mock()

    def test_find_by_id(self):
        user_id = 1
        user_repository_mock.find_by_id.return_value = user_id

        a = user_service.find_by_id(user_id)

        self.assertEqual(a, user_id)
        user_repository_mock.find_by_id.assert_called_once()
        user_repository_mock.find_by_id.assert_called_with(1)

    def test_find_members(self):
        user_service.find_members()

        user_repository_mock.find_members.assert_called_once()
{'fraction_non_alphanumeric': 0.07360097323600973, 'fraction_numerical': 0.0024330900243309003, 'mean_word_length': 4.172955974842767, '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': '4594260', 'n_tokens_mistral': 533, 'n_tokens_neox': 514, 'n_words': 85}