<commit_before># -*- coding: utf-8 -*-
# system
import os
import re
import sys
import unittest
from os.path import join, pardir, abspath, dirname

# tools
import nose


os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.conf'
sys.path.insert(0, abspath(join(dirname(__file__), pardir)))


TestCase = unittest.TestCase
n        = nose.tools


class AssertQueriesCountMixin(object):
    def assert_queries_count(self, num, func=None, *args, **kwargs):
        from django.test.testcases import _AssertNumQueriesContext
        from django.db import connections, DEFAULT_DB_ALIAS

        using = kwargs.pop("using", DEFAULT_DB_ALIAS)
        conn = connections[using]

        context = _AssertNumQueriesContext(self, num, conn)
        if func is None:
            return context

        with context:
            func(*args, **kwargs)


class DBTestCase(TestCase, AssertQueriesCountMixin):
    test_runner, old_config = None, None

    def setUp(self):
        from django.test.simple import DjangoTestSuiteRunner
        self.test_runner = DjangoTestSuiteRunner()<commit_msg>tests: removing "n" helper (step 1) - TestCase with basic assertions created<commit_after># -*- coding: utf-8 -*-
# system
import os
import re
import sys
import unittest
from os.path import join, pardir, abspath, dirname

# tools
import nose


os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.conf'
sys.path.insert(0, abspath(join(dirname(__file__), pardir)))


n = nose.tools


class AssertQueriesCountMixin(object):
    def assert_queries_count(self, num, func=None, *args, **kwargs):
        from django.test.testcases import _AssertNumQueriesContext
        from django.db import connections, DEFAULT_DB_ALIAS

        using = kwargs.pop("using", DEFAULT_DB_ALIAS)
        conn = connections[using]

        context = _AssertNumQueriesContext(self, num, conn)
        if func is None:
            return context

        with context:
            func(*args, **kwargs)


n = nose.tools


class TestCase(unittest.TestCase):
    assert_equal = unittest.TestCase.assertEqual
    assert_not_equal = unittest.TestCase.assertNotEqual
    assert_true = unittest.TestCase.assertTrue
    assert_false = unittest.TestCase.assertFalse


class DBTestCase(TestCase, AssertQueriesCountMixin):
    test_runner, old_config = None, None

    def setUp(self):
        from django.test.simple import DjangoTestSuiteRunner
        self.test_runner = DjangoTestSuiteRunner()
{'fraction_non_alphanumeric': 0.09150865622423743, 'fraction_numerical': 0.002061005770816158, 'mean_word_length': 3.5879017013232515, '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': '3052382', 'n_tokens_mistral': 737, 'n_tokens_neox': 717, 'n_words': 183}