<commit_before># -*- coding: utf-8 -*-

from unittest import TestCase

from byceps.application import create_app
from byceps.database import db


class AbstractAppTestCase(TestCase):

    def setUp(self):
        self.app = create_app('test', initialize=False)

        db.app = self.app
        db.create_all()

    def tearDown(self):
        db.session.remove()
        db.drop_all()<commit_msg>Prepare application test with current brand and party.<commit_after># -*- coding: utf-8 -*-

from unittest import TestCase

from byceps.application import create_app
from byceps.blueprints.brand.models import Brand
from byceps.blueprints.party.models import Party
from byceps.database import db


class AbstractAppTestCase(TestCase):

    def setUp(self):
        self.app = create_app('test', initialize=False)

        self.db = db
        db.app = self.app
        db.create_all()

        self.create_brand_and_party()

        self.client = self.app.test_client()

    def create_brand_and_party(self):
        brand = Brand(id='acme', title='ACME')
        db.session.add(brand)
        party = Party(id='acme-2014', brand=brand, title='ACME 2014')
        db.session.add(party)
        db.session.commit()

    def tearDown(self):
        db.session.remove()
        db.drop_all()
{'fraction_non_alphanumeric': 0.11206225680933853, 'fraction_numerical': 0.007782101167315175, 'mean_word_length': 2.896969696969697, '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': '1845755', 'n_tokens_mistral': 406, 'n_tokens_neox': 387, 'n_words': 90}