<commit_before>import os
import unittest
from datetime import datetime
from unittest.mock import patch

import duolingo

USERNAME = os.environ.get('DUOLINGO_USER', 'ferguslongley')
PASSWORD = os.environ.get('DUOLINGO_PASSWORD')
USERNAME2 = os.environ.get("DUOLINGO_USER_2", "Spaniard")


class DuolingoTest(unittest.TestCase):
    lingo = duolingo.Duolingo(USERNAME, PASSWORD)

    def setUp(self):
        self.lang = self.lingo.user_data.learning_language

    @patch("duolingo.Duolingo._get_data")<commit_msg>Set up lingo and tear it down properly so that sessions are tidied up<commit_after>import os
import unittest
from datetime import datetime
from unittest.mock import patch

import duolingo

USERNAME = os.environ.get('DUOLINGO_USER', 'ferguslongley')
PASSWORD = <PASSWORD>('DU<PASSWORD>O_PASSWORD')
USERNAME2 = os.environ.get("DUOLINGO_USER_2", "Spaniard")


class DuolingoTest(unittest.TestCase):

    def setUp(self):
        self.lingo = duolingo.Duolingo(USERNAME, PASSWORD)
        self.lang = self.lingo.user_data.learning_language

    def tearDown(self):
        self.lingo.session.close()

    @patch("duolingo.Duolingo._get_data")
{'fraction_non_alphanumeric': 0.10521739130434783, 'fraction_numerical': 0.0034782608695652175, 'mean_word_length': 5.057894736842106, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '151858', 'n_tokens_mistral': 399, 'n_tokens_neox': 394, 'n_words': 79}