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

# Standard library imports
# Third party imports
from django.core.urlresolvers import reverse
from django.core.urlresolvers import NoReverseMatch

# Local application / specific library imports


class AdminClientMixin(object):
    """
    Mixin that can be used to append a test to an AdminClientTestCase in order to
    test that the admin base views associated with a given model are accessible
    and so avoid some boilerplate code.
    """
    model = None

    def test_has_accessible_base_views(self):
        model = self.model
        urls = (
            'admin:{}_{}_changelist',
            'admin:{}_{}_add',
        )
        urls = [raw_url.format(model._meta.app_label, model._meta.module_name) for raw_url in urls]
        try:
            for raw_url in urls:
                url = reverse(raw_url)
                response = self.client.get(url, follow=True)
                self.assertIsOk(response)
        except NoReverseMatch:
            self.fail('At least one admin base views is not available for the following model: {}'.format(model))
<commit_msg>Machina test module updated<commit_after># -*- coding: utf-8 -*-

# Standard library imports
# Third party imports
from django.core.urlresolvers import reverse
from django.core.urlresolvers import NoReverseMatch

# Local application / specific library imports


class AdminBaseViewTestMixin(object):
    """
    Mixin that can be used to append a test to an AdminClientTestCase in order to
    test that the admin base views associated with a given model are accessible
    and so avoid some boilerplate code.
    """
    model = None

    def test_has_accessible_base_views(self):
        model = self.model
        urls = (
            'admin:{}_{}_changelist',
            'admin:{}_{}_add',
        )
        urls = [raw_url.format(model._meta.app_label, model._meta.module_name) for raw_url in urls]
        try:
            for raw_url in urls:
                url = reverse(raw_url)
                response = self.client.get(url, follow=True)
                self.assertIsOk(response)
        except NoReverseMatch:
            self.fail('At least one admin base views is not available for the following model: {}'.format(model))

{'fraction_non_alphanumeric': 0.08244680851063829, 'fraction_numerical': 0.0008865248226950354, 'mean_word_length': 2.54874213836478, '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': '7112611', 'n_tokens_mistral': 630, 'n_tokens_neox': 609, 'n_words': 205}