<commit_before>
from nose.plugins.attrib import attr
from tests.test_base import BaseTestCase

from tests.mock.factories import (
    generate_fake_data,
    generate_fake_users,
    generate_fake_typeforms,
    generate_fake_responses,
    UserFactory,
    TypeformFactory,
    SeamlessDocFactory,
    TypeformResponseFactory,
    User,
    Typeform, TypeformResponse, SeamlessDoc
    )


class TestModelSaving(BaseTestCase):

    def test_save_a_user(self):
        generate_fake_users(1)
        users = User.query.all()
        self.assertEqual(len(users), 1)
        self.assertTrue(users[0].id)

    def test_save_a_typeform(self):
        form = TypeformFactory.create()
        forms = Typeform.query.all()
        self.assertEqual(len(forms), 1)
        self.assertTrue(forms[0].id)

    def test_save_a_seamless_doc(self):
        doc = SeamlessDocFactory.create()
        docs = SeamlessDoc.query.all()
        self.assertEqual(len(docs), 1)
        self.assertTrue(docs[0].id)

    def test_save_a_response(self):
        response = generate_fake_responses(None, 1)[0]
        responses = TypeformResponse.query.all()
        self.assertEqual(len(responses), 1)
        self.assertTrue(responses[0].id)

    @attr(speed="slow")
    def test_save_everything(self):
        data = generate_fake_data(num_users=10)
        user_report, user_data, users, form_sets, response_sets = data
        users = User.query.all()
        forms = Typeform.query.all()
        responses = TypeformResponse.query.all()
        self.assertTrue(len(users) == 10)
        self.assertTrue(len(forms) > 0)
        self.assertTrue(len(responses) > 0)<commit_msg>forgot to include new test changes<commit_after>
from nose.plugins.attrib import attr
from tests.test_base import BaseTestCase

from tests.mock.factories import (
    generate_fake_data,
    generate_fake_users,
    generate_fake_typeforms,
    generate_fake_responses,
    UserFactory,
    TypeformFactory,
    SeamlessDocFactory,
    TypeformResponseFactory,
    User,
    Typeform, TypeformResponse, SeamlessDoc
    )


class TestModelSaving(BaseTestCase):

    def test_save_a_user(self):
        generate_fake_users(1)
        users = User.query.all()
        self.assertEqual(len(users), 1)
        self.assertTrue(users[0].id)

    def test_save_a_typeform(self):
        form = TypeformFactory.create()
        forms = Typeform.query.all()
        self.assertEqual(len(forms), 1)
        self.assertTrue(forms[0].id)

    def test_save_a_seamless_doc(self):
        doc = SeamlessDocFactory.create()
        docs = SeamlessDoc.query.all()
        self.assertEqual(len(docs), 1)
        self.assertTrue(docs[0].id)

    def test_save_a_response(self):
        response = generate_fake_responses(None, 1)[0]
        responses = TypeformResponse.query.all()
        self.assertEqual(len(responses), 1)
        self.assertTrue(responses[0].id)

    @attr(speed="slow")
    def test_save_everything(self):
        data = generate_fake_data(num_users=10)
        user_report, user_data, users, form_sets, doc_sets, response_sets = data
        users = User.query.all()
        forms = Typeform.query.all()
        docs = SeamlessDoc.query.all()
        responses = TypeformResponse.query.all()
        self.assertTrue(len(users) == 10)
        self.assertTrue(len(forms) > 0)
        self.assertTrue(len(docs) > 0)
        self.assertTrue(len(responses) > 0)
{'fraction_non_alphanumeric': 0.10436822046320728, 'fraction_numerical': 0.010260920551158018, 'mean_word_length': 3.0522565320665085, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '2724630', 'n_tokens_mistral': 1097, 'n_tokens_neox': 1074, 'n_words': 179}