<commit_before>from __future__ import absolute_import

from django.contrib.auth.models import User
from noseperf.testcases import DjangoPerformanceTest


class DjangoSampleTest(DjangoPerformanceTest):
    def test_create_a_bunch_of_users(self):
        for n in xrange(2 ** 8):
            User.objects.create(username='test-%d' % n, email='<EMAIL>' % n)<commit_msg>Add basic cache test example<commit_after>from __future__ import absolute_import

from django.core.cache import cache
from django.contrib.auth.models import User
from noseperf.testcases import DjangoPerformanceTest


class DjangoSampleTest(DjangoPerformanceTest):
    def test_create_a_bunch_of_users(self):
        for n in xrange(2 ** 8):
            User.objects.create(username='test-%d' % n, email='<EMAIL>' % n)

    def test_use_the_cache(self):
        for n in xrange(2 ** 6):
            cache.set('test-%s' % (n - 1), n)
            cache.set('test-%s-%s' % (n, n - 1), cache.get('test-%s' % (n - 1)))
{'fraction_non_alphanumeric': 0.12065439672801637, 'fraction_numerical': 0.009202453987730062, 'mean_word_length': 3.7756097560975608, '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': '2723301', 'n_tokens_mistral': 322, 'n_tokens_neox': 303, 'n_words': 75}