<commit_before>import bookmarks
import unittest


class FlaskrTestCase(unittest.TestCase):
    def setUp(self):
        self.app = bookmarks.app.test_client()
        # with bookmarks.app.app_context():
        bookmarks.database.init_db()

    def tearDown(self):
        # with bookmarks.app.app_context():
        bookmarks.database.db_session.remove()
        bookmarks.database.Base.metadata.drop_all(
            bind=bookmarks.database.engine)

    def test_empty_db(self):
        rv = self.app.get('/')
        assert b'There aren\'t any bookmarks yet.' in rv.data

    def register(self, username, name, email, password):
        return self.app.post('/register_user/', data=dict(
            username=username,
            name=name,
            email=email,
            password=password,
            confirm=password
        ), follow_redirects=True)

    def login(self, username, password):
        return self.app.post('/login', data=dict(
            username=username,
            password=password,
            confirm=password
        ), follow_redirects=True)

    def logout(self):
        return self.app.get('/logout', follow_redirects=True)<commit_msg>Add param for confirm field on register test func<commit_after>import bookmarks
import unittest


class FlaskrTestCase(unittest.TestCase):
    def setUp(self):
        self.app = bookmarks.app.test_client()
        # with bookmarks.app.app_context():
        bookmarks.database.init_db()

    def tearDown(self):
        # with bookmarks.app.app_context():
        bookmarks.database.db_session.remove()
        bookmarks.database.Base.metadata.drop_all(
            bind=bookmarks.database.engine)

    def test_empty_db(self):
        rv = self.app.get('/')
        assert b'There aren\'t any bookmarks yet.' in rv.data

    def register(self, username, name, email, password, confirm=None):
        return self.app.post('/register_user/', data=dict(
            username=username,
            name=name,
            email=email,
            password=password,
            confirm=confirm
        ), follow_redirects=True)

    def login(self, username, password):
        return self.app.post('/login', data=dict(
            username=username,
            password=password,
            confirm=password
        ), follow_redirects=True)

    def logout(self):
        return self.app.get('/logout', follow_redirects=True)
{'fraction_non_alphanumeric': 0.10986267166042447, 'fraction_numerical': 0.0, 'mean_word_length': 2.4245014245014245, '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': '2230925', 'n_tokens_mistral': 679, 'n_tokens_neox': 665, 'n_words': 134}