<commit_before>
from unittest import TestCase
from django.test.utils import setup_test_template_loader, override_settings
from django.template import Context
from django.template.loader import get_template

TEMPLATES = {
    'basetag': '''{% load damn %}{% assets %}''',
    'test2': '''
<!doctype html>{% load damn %}
<html>
<head>
{% assets %}
</head>
<body>
{% asset 'js/jquery.js' %}
</body>
</html>
''',
}

DAMN_PROCESSORS = {
    'js': {
        'class': 'damn.processors.ScriptProcessor',
    },
}

class TagTests(TestCase):

    def setUp(self):
        setup_test_template_loader(TEMPLATES)

    @override_settings(
        DAMN_PROCESSORS=DAMN_PROCESSORS,
    )
    def test_simple(self):
        t = get_template('basetag')
        t.render()

    @override_settings(
        DAMN_PROCESSORS=DAMN_PROCESSORS,
    )
    def test_one(self):
        t = get_template('test2')
        o = t.render(Context())
        self.assertContains(o, '<script src="/static/js/jquery.js"></script>')
<commit_msg>Use TestCase from Django Set STATIC_URL<commit_after>
#from unittest import TestCase
from django.test import TestCase

from django.test.utils import setup_test_template_loader, override_settings
from django.template import Context
from django.template.loader import get_template

TEMPLATES = {
    'basetag': '''{% load damn %}{% assets %}''',
    'test2': '''
<!doctype html>{% load damn %}
<html>
<head>
{% assets %}
</head>
<body>
{% asset 'js/jquery.js' %}
</body>
</html>
''',
}

DAMN_PROCESSORS = {
    'js': {
        'processor': 'damn.processors.ScriptProcessor',
    },
}

class TagTests(TestCase):

    def setUp(self):
        setup_test_template_loader(TEMPLATES)

    @override_settings(
        DAMN_PROCESSORS=DAMN_PROCESSORS,
        STATIC_URL = '/',
    )
    def test_simple(self):
        t = get_template('basetag')
        t.render()

    @override_settings(
        DAMN_PROCESSORS=DAMN_PROCESSORS,
        STATIC_URL = '/',
    )
    def test_one(self):
        t = get_template('test2')
        o = t.render(Context())
        self.assertTrue('<script src="/static/js/jquery.js"></script>' in o)

{'fraction_non_alphanumeric': 0.14795678722404884, 'fraction_numerical': 0.0018788163457022077, 'mean_word_length': 3.303030303030303, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': 4, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2804157', 'n_tokens_mistral': 751, 'n_tokens_neox': 718, 'n_words': 140}