repo
stringlengths
7
90
file_url
stringlengths
81
315
file_path
stringlengths
4
228
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:38:15
2026-01-05 02:33:18
truncated
bool
2 classes
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/empty_models/__init__.py
tests/empty_models/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/empty_models/test_commands.py
tests/empty_models/test_commands.py
import io from django.core.management import call_command from django.test import TestCase class CoreCommandsNoOutputTests(TestCase): available_apps = ["empty_models"] def test_sqlflush_no_tables(self): out = io.StringIO() err = io.StringIO() call_command("sqlflush", stdout=out, stde...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/sites_framework/models.py
tests/sites_framework/models.py
from django.contrib.sites.managers import CurrentSiteManager from django.contrib.sites.models import Site from django.db import models class AbstractArticle(models.Model): title = models.CharField(max_length=50) objects = models.Manager() on_site = CurrentSiteManager() class Meta: abstract =...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/sites_framework/__init__.py
tests/sites_framework/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/sites_framework/tests.py
tests/sites_framework/tests.py
from django.conf import settings from django.contrib.sites.managers import CurrentSiteManager from django.contrib.sites.models import Site from django.core import checks from django.db import models from django.test import SimpleTestCase, TestCase from django.test.utils import isolate_apps from .models import CustomAr...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/sites_framework/migrations/0001_initial.py
tests/sites_framework/migrations/0001_initial.py
from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("sites", "0001_initial"), ] operations = [ migrations.CreateModel( name="CustomArticle", fields=[ ( "id", model...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/sites_framework/migrations/__init__.py
tests/sites_framework/migrations/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/import_error_package/__init__.py
tests/import_error_package/__init__.py
# A package that raises an ImportError that can be shared among test apps and # excluded from test discovery. raise ImportError("Oops")
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_backends/test_jinja2.py
tests/template_backends/test_jinja2.py
from pathlib import Path from unittest import mock, skipIf from django.contrib.auth.models import User from django.template import TemplateSyntaxError from django.test import RequestFactory, TestCase from .test_dummy import TemplateStringsTests try: import jinja2 except ImportError: jinja2 = None Jinja2 ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_backends/test_utils.py
tests/template_backends/test_utils.py
from django.core.exceptions import ImproperlyConfigured from django.template import engines from django.test import SimpleTestCase, override_settings class TemplateUtilsTests(SimpleTestCase): @override_settings(TEMPLATES=[{"BACKEND": "raise.import.error"}]) def test_backend_import_error(self): """ ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_backends/test_django.py
tests/template_backends/test_django.py
from pathlib import Path from template_tests.test_response import test_processor_name from django.template import Context, EngineHandler, RequestContext from django.template.backends.django import DjangoTemplates from django.template.library import InvalidTemplateLibrary from django.test import RequestFactory, overri...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_backends/__init__.py
tests/template_backends/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_backends/test_dummy.py
tests/template_backends/test_dummy.py
import re from django.forms import CharField, Form, Media from django.http import HttpRequest, HttpResponse from django.middleware.csrf import ( CSRF_TOKEN_LENGTH, CsrfViewMiddleware, _unmask_cipher_token, get_token, ) from django.template import TemplateDoesNotExist, TemplateSyntaxError from django.te...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_backends/apps/__init__.py
tests/template_backends/apps/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_backends/apps/good/__init__.py
tests/template_backends/apps/good/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_backends/apps/good/templatetags/good_tags.py
tests/template_backends/apps/good/templatetags/good_tags.py
from django.template import Library register = Library()
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_backends/apps/good/templatetags/__init__.py
tests/template_backends/apps/good/templatetags/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_backends/apps/good/templatetags/empty.py
tests/template_backends/apps/good/templatetags/empty.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_backends/apps/good/templatetags/override.py
tests/template_backends/apps/good/templatetags/override.py
from django.template import Library register = Library()
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_backends/apps/good/templatetags/subpackage/tags.py
tests/template_backends/apps/good/templatetags/subpackage/tags.py
from django.template import Library register = Library()
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_backends/apps/good/templatetags/subpackage/__init__.py
tests/template_backends/apps/good/templatetags/subpackage/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_backends/apps/importerror/__init__.py
tests/template_backends/apps/importerror/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_backends/apps/importerror/templatetags/broken_tags.py
tests/template_backends/apps/importerror/templatetags/broken_tags.py
import DoesNotExist # noqa
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_backends/apps/importerror/templatetags/__init__.py
tests/template_backends/apps/importerror/templatetags/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/or_lookups/models.py
tests/or_lookups/models.py
""" OR lookups To perform an OR lookup, or a lookup that combines ANDs and ORs, combine ``QuerySet`` objects using ``&`` and ``|`` operators. Alternatively, use positional arguments, and pass one or more expressions of clauses using the variable ``django.db.models.Q``. """ from django.db import models class Articl...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/or_lookups/__init__.py
tests/or_lookups/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/or_lookups/tests.py
tests/or_lookups/tests.py
from datetime import datetime from operator import attrgetter from django.db.models import Q from django.test import TestCase from .models import Article class OrLookupsTests(TestCase): @classmethod def setUpTestData(cls): cls.a1 = Article.objects.create( headline="Hello", pub_date=datet...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/expressions/models.py
tests/expressions/models.py
""" Tests for F() query expression syntax. """ import uuid from django.db import models class Manager(models.Model): name = models.CharField(max_length=50) secretary = models.ForeignKey( "Employee", models.CASCADE, null=True, related_name="managers" ) class Employee(models.Model): firstnam...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/expressions/__init__.py
tests/expressions/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/expressions/tests.py
tests/expressions/tests.py
import datetime import pickle import unittest import uuid from collections import namedtuple from copy import deepcopy from decimal import Decimal from unittest import mock from django.core.exceptions import FieldError from django.db import DatabaseError, NotSupportedError, connection from django.db.models import ( ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
true
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/expressions/test_queryset_values.py
tests/expressions/test_queryset_values.py
from django.db.models import F, Sum from django.test import TestCase, skipUnlessDBFeature from django.utils.deprecation import RemovedInDjango70Warning from .models import Company, Employee, JSONFieldModel class ValuesExpressionsTests(TestCase): @classmethod def setUpTestData(cls): Company.objects.cr...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/admin_default_site/sites.py
tests/admin_default_site/sites.py
from django.contrib import admin class CustomAdminSite(admin.AdminSite): pass
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/admin_default_site/__init__.py
tests/admin_default_site/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/admin_default_site/tests.py
tests/admin_default_site/tests.py
from django.contrib import admin from django.contrib.admin import sites from django.test import SimpleTestCase, override_settings from .sites import CustomAdminSite @override_settings( INSTALLED_APPS=[ "admin_default_site.apps.MyCustomAdminConfig", "django.contrib.auth", "django.contrib.c...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/admin_default_site/apps.py
tests/admin_default_site/apps.py
from django.contrib.admin.apps import SimpleAdminConfig class MyCustomAdminConfig(SimpleAdminConfig): verbose_name = "My custom default admin site." default_site = "admin_default_site.sites.CustomAdminSite"
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/test_client_regress/views.py
tests/test_client_regress/views.py
from urllib.parse import urlencode from django.conf import settings from django.contrib.auth.decorators import login_required from django.http import HttpResponse, HttpResponseRedirect, JsonResponse from django.shortcuts import render from django.template.loader import render_to_string from django.test import Client f...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/test_client_regress/models.py
tests/test_client_regress/models.py
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager from django.db import models class CustomUser(AbstractBaseUser): email = models.EmailField(verbose_name="email address", max_length=255, unique=True) custom_objects = BaseUserManager() USERNAME_FIELD = "email" class Meta: ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/test_client_regress/context_processors.py
tests/test_client_regress/context_processors.py
def special(request): return {"path": request.special_path}
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/test_client_regress/auth_backends.py
tests/test_client_regress/auth_backends.py
from django.contrib.auth.backends import ModelBackend from .models import CustomUser class CustomUserBackend(ModelBackend): def authenticate(self, request, username=None, password=None): try: user = CustomUser.custom_objects.get_by_natural_key(username) if user.check_password(pass...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/test_client_regress/__init__.py
tests/test_client_regress/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/test_client_regress/session.py
tests/test_client_regress/session.py
from django.contrib.sessions.backends.base import SessionBase class SessionStore(SessionBase): """ A simple cookie-based session storage implementation. The session key is actually the session data, pickled and encoded. This means that saving the session will change the session key. """ def ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/test_client_regress/tests.py
tests/test_client_regress/tests.py
""" Regression tests for the Test Client, especially the customized assertions. """ import itertools import os from django.contrib.auth.models import User from django.contrib.auth.signals import user_logged_in, user_logged_out from django.http import HttpResponse from django.template import Context, RequestContext, T...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
true
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/test_client_regress/urls.py
tests/test_client_regress/urls.py
from django.urls import include, path from django.views.generic import RedirectView from . import views urlpatterns = [ path("", include("test_client.urls")), path("no_template_view/", views.no_template_view), path("staff_only/", views.staff_only_view), path("get_view/", views.get_view), path("req...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/generic_relations_regress/models.py
tests/generic_relations_regress/models.py
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import models __all__ = ( "Link", "Place", "Restaurant", "Person", "Address", "CharLink", "TextLink", "OddRelation1", "OddRelat...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/generic_relations_regress/__init__.py
tests/generic_relations_regress/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/generic_relations_regress/tests.py
tests/generic_relations_regress/tests.py
from django.contrib.contenttypes.models import ContentType from django.db.models import ProtectedError, Q, Sum from django.forms.models import modelform_factory from django.test import TestCase, skipIfDBFeature from .models import ( A, Address, B, Board, C, Cafe, CharLink, Company, ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/select_for_update/models.py
tests/select_for_update/models.py
from django.db import models class Entity(models.Model): pass class Country(Entity): name = models.CharField(max_length=30) class EUCountry(Country): join_date = models.DateField() class City(models.Model): name = models.CharField(max_length=30) country = models.ForeignKey(Country, models.CA...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/select_for_update/__init__.py
tests/select_for_update/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/select_for_update/tests.py
tests/select_for_update/tests.py
import threading import time from unittest import mock from multiple_database.routers import TestRouter from django.core.exceptions import FieldError from django.db import ( DatabaseError, NotSupportedError, connection, connections, router, transaction, ) from django.db.models import F, Value ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/reverse_lookup/models.py
tests/reverse_lookup/models.py
""" Reverse lookups This demonstrates the reverse lookup features of the database API. """ from django.db import models class User(models.Model): name = models.CharField(max_length=200) class Poll(models.Model): question = models.CharField(max_length=200) creator = models.ForeignKey(User, models.CASCA...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/reverse_lookup/__init__.py
tests/reverse_lookup/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/reverse_lookup/tests.py
tests/reverse_lookup/tests.py
from django.core.exceptions import FieldError from django.test import TestCase from .models import Choice, Poll, User class ReverseLookupTests(TestCase): @classmethod def setUpTestData(cls): john = User.objects.create(name="John Doe") jim = User.objects.create(name="Jim Bo") first_pol...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/signing/__init__.py
tests/signing/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/signing/tests.py
tests/signing/tests.py
import datetime from django.core import signing from django.test import SimpleTestCase, override_settings from django.test.utils import freeze_time from django.utils.crypto import InvalidAlgorithm class TestSigner(SimpleTestCase): def test_signature(self): "signature() method should generate a signature"...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/sphinx/test_github_links.py
tests/sphinx/test_github_links.py
import pathlib import sys from django.test import SimpleTestCase def last_n_parts(path, n): return "/".join(path.parts[-n:]) # The import must happen at the end of setUpClass, so it can't be imported at # the top of the file. github_links = None class GitHubLinkTests(SimpleTestCase): @classmethod def...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/sphinx/__init__.py
tests/sphinx/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/sphinx/testdata/package/import_error.py
tests/sphinx/testdata/package/import_error.py
from .....test import Test # noqa class MyClass: pass
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/sphinx/testdata/package/wildcard_base.py
tests/sphinx/testdata/package/wildcard_base.py
class WildcardMixin: pass
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/sphinx/testdata/package/module.py
tests/sphinx/testdata/package/module.py
""" Example docstring """ from django.utils.functional import cached_property from tests.sphinx.testdata.package.wildcard_module import * # noqa from . import other_module # noqa from .other_module import MyOtherClass # noqa class MyClass(object): def __init__(self): pass def my_method(self): ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/sphinx/testdata/package/__init__.py
tests/sphinx/testdata/package/__init__.py
# This file should never get imported. If it is, then something failed already. raise Exception
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/sphinx/testdata/package/wildcard_module.py
tests/sphinx/testdata/package/wildcard_module.py
from .wildcard_base import WildcardMixin # noqa class WildcardClass: pass
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/sphinx/testdata/package/other_module.py
tests/sphinx/testdata/package/other_module.py
class MyOtherClass: pass
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/admin_utils/test_logentry.py
tests/admin_utils/test_logentry.py
import json from datetime import datetime from django.contrib.admin.models import ADDITION, CHANGE, DELETION, LogEntry from django.contrib.admin.utils import quote from django.contrib.auth.models import User from django.contrib.contenttypes.models import ContentType from django.db.models.signals import post_save, pre_...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/admin_utils/admin.py
tests/admin_utils/admin.py
from django import forms from django.contrib import admin from .models import Article, ArticleProxy, Site class ArticleAdminForm(forms.ModelForm): nolabel_form_field = forms.BooleanField(required=False) class Meta: model = Article fields = ["title"] @property def changed_data(self):...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/admin_utils/models.py
tests/admin_utils/models.py
from django.contrib import admin from django.db import models from django.utils.translation import gettext_lazy as _ class Site(models.Model): domain = models.CharField(max_length=100) def __str__(self): return self.domain class Article(models.Model): """ A simple Article model for testing ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/admin_utils/__init__.py
tests/admin_utils/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/admin_utils/tests.py
tests/admin_utils/tests.py
from datetime import datetime from decimal import Decimal from django import forms from django.conf import settings from django.contrib import admin from django.contrib.admin import helpers from django.contrib.admin.utils import ( NestedObjects, build_q_object_from_lookup_parameters, display_for_field, ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/admin_utils/urls.py
tests/admin_utils/urls.py
from django.urls import path from .admin import custom_site, site urlpatterns = [ path("test_admin/admin/", site.urls), path("test_admin/custom_admin/", custom_site.urls), ]
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/flatpages_tests/no_slash_urls.py
tests/flatpages_tests/no_slash_urls.py
from django.urls import include, path urlpatterns = [ path("flatpage", include("django.contrib.flatpages.urls")), ]
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/flatpages_tests/test_forms.py
tests/flatpages_tests/test_forms.py
from django.conf import settings from django.contrib.flatpages.forms import FlatpageForm from django.contrib.flatpages.models import FlatPage from django.contrib.sites.models import Site from django.test import TestCase, modify_settings, override_settings from django.utils import translation @modify_settings(INSTALLE...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/flatpages_tests/test_views.py
tests/flatpages_tests/test_views.py
from django.conf import settings from django.contrib.auth.models import User from django.contrib.flatpages.models import FlatPage from django.contrib.sites.models import Site from django.test import TestCase, modify_settings, override_settings from .settings import FLATPAGES_TEMPLATES class TestDataMixin: @class...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/flatpages_tests/test_templatetags.py
tests/flatpages_tests/test_templatetags.py
from django.contrib.auth.models import AnonymousUser, User from django.contrib.flatpages.models import FlatPage from django.contrib.sites.models import Site from django.template import Context, Template, TemplateSyntaxError from django.test import TestCase class FlatpageTemplateTagTests(TestCase): @classmethod ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/flatpages_tests/test_csrf.py
tests/flatpages_tests/test_csrf.py
from django.contrib.auth.models import User from django.contrib.flatpages.models import FlatPage from django.contrib.sites.models import Site from django.test import Client, TestCase, modify_settings, override_settings from .settings import FLATPAGES_TEMPLATES @modify_settings(INSTALLED_APPS={"append": "django.contr...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/flatpages_tests/test_models.py
tests/flatpages_tests/test_models.py
from django.contrib.flatpages.models import FlatPage from django.test import SimpleTestCase, override_settings from django.test.utils import override_script_prefix class FlatpageModelTests(SimpleTestCase): def setUp(self): self.page = FlatPage(title="Café!", url="/café/") def test_get_absolute_url_ur...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/flatpages_tests/test_middleware.py
tests/flatpages_tests/test_middleware.py
from django.conf import settings from django.contrib.auth.models import User from django.contrib.flatpages.models import FlatPage from django.contrib.sites.models import Site from django.test import TestCase, modify_settings, override_settings from .settings import FLATPAGES_TEMPLATES class TestDataMixin: @class...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/flatpages_tests/settings.py
tests/flatpages_tests/settings.py
import os FLATPAGES_TEMPLATES = [ { "BACKEND": "django.template.backends.django.DjangoTemplates", "DIRS": [os.path.join(os.path.dirname(__file__), "templates")], "OPTIONS": { "context_processors": ("django.contrib.auth.context_processors.auth",), }, } ]
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/flatpages_tests/test_sitemaps.py
tests/flatpages_tests/test_sitemaps.py
from django.apps import apps from django.contrib.sites.models import Site from django.test import TestCase from django.test.utils import modify_settings, override_settings @override_settings( ROOT_URLCONF="flatpages_tests.urls", SITE_ID=1, ) @modify_settings( INSTALLED_APPS={ "append": ["django.co...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/flatpages_tests/__init__.py
tests/flatpages_tests/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/flatpages_tests/absolute_urls.py
tests/flatpages_tests/absolute_urls.py
from django.contrib.flatpages import views from django.urls import path urlpatterns = [ path("flatpage/", views.flatpage, {"url": "/hardcoded/"}), ]
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/flatpages_tests/urls.py
tests/flatpages_tests/urls.py
from django.contrib.flatpages.sitemaps import FlatPageSitemap from django.contrib.sitemaps import views from django.urls import include, path urlpatterns = [ path( "flatpages/sitemap.xml", views.sitemap, {"sitemaps": {"flatpages": FlatPageSitemap}}, name="django.contrib.sitemaps.vie...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/test_library.py
tests/template_tests/test_library.py
import functools import unittest from django.template import Library from django.template.base import Node from django.test import SimpleTestCase from django.utils.version import PY314 class FilterRegistrationTests(SimpleTestCase): def setUp(self): self.library = Library() def test_filter(self): ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/test_engine.py
tests/template_tests/test_engine.py
import os from django.core.exceptions import ImproperlyConfigured from django.template import Context from django.template.engine import Engine from django.test import SimpleTestCase, override_settings from .utils import ROOT, TEMPLATE_DIR OTHER_DIR = os.path.join(ROOT, "other_templates") class EngineTest(SimpleTe...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/test_logging.py
tests/template_tests/test_logging.py
import logging from django.template import Engine, Variable, VariableDoesNotExist from django.test import SimpleTestCase class VariableResolveLoggingTests(SimpleTestCase): loglevel = logging.DEBUG def test_log_on_variable_does_not_exist_silent(self): class TestObject: class SilentDoesNot...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/views.py
tests/template_tests/views.py
# Fake views for testing url reverse lookup from django.http import HttpResponse from django.template.response import TemplateResponse def index(request): pass def client(request, id): pass def client_action(request, id, action): pass def client2(request, tag): pass def template_response_view(...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/test_parser.py
tests/template_tests/test_parser.py
""" Testing some internals of the template processing. These are *not* examples to be copied in user code. """ import unittest from django.template import Library, TemplateSyntaxError from django.template.base import ( FilterExpression, Lexer, Parser, Token, TokenType, Variable, VariableDo...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/test_origin.py
tests/template_tests/test_origin.py
import os from unittest import TestCase from django.template import Engine from .utils import TEMPLATE_DIR class OriginTestCase(TestCase): def setUp(self): self.engine = Engine(dirs=[TEMPLATE_DIR]) def test_origin_compares_equal(self): a = self.engine.get_template("index.html") b = ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/test_base.py
tests/template_tests/test_base.py
from django.template import Context, Template, Variable, VariableDoesNotExist from django.template.base import DebugLexer, Lexer, TokenType from django.test import SimpleTestCase from django.utils.translation import gettext_lazy class LexerTestMixin: template_string = ( "text\n" "{% if test %}{{ v...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/test_nodelist.py
tests/template_tests/test_nodelist.py
from django.template import Context, Engine from django.template.base import TextNode, VariableNode from django.test import SimpleTestCase class NodelistTest(SimpleTestCase): @classmethod def setUpClass(cls): cls.engine = Engine() super().setUpClass() def test_for(self): template ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/test_extends.py
tests/template_tests/test_extends.py
import os from django.template import Context, Engine, TemplateDoesNotExist, TemplateSyntaxError from django.test import SimpleTestCase from .utils import ROOT, setup RECURSIVE = os.path.join(ROOT, "recursive_templates") class ExtendsBehaviorTests(SimpleTestCase): def test_normal_extend(self): engine =...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/test_custom.py
tests/template_tests/test_custom.py
import os from django.template import Context, Engine, TemplateSyntaxError from django.template.base import Node from django.template.library import InvalidTemplateLibrary, Library from django.test import SimpleTestCase from django.test.utils import extend_sys_path from .templatetags import custom, inclusion from .ut...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
true
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/test_extends_relative.py
tests/template_tests/test_extends_relative.py
import os from django.template import Context, Engine, TemplateSyntaxError from django.test import SimpleTestCase from .utils import ROOT RELATIVE = os.path.join(ROOT, "relative_templates") class ExtendsRelativeBehaviorTests(SimpleTestCase): def test_normal_extend(self): engine = Engine(dirs=[RELATIVE]...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/annotated_tag_function.py
tests/template_tests/annotated_tag_function.py
from django import template register = template.Library() @register.simple_tag() def annotated_tag_function(val: int): return val
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/test_context.py
tests/template_tests/test_context.py
from copy import copy from unittest import mock from django.http import HttpRequest from django.template import ( Context, Engine, RequestContext, Template, Variable, VariableDoesNotExist, ) from django.template.context import RenderContext from django.test import RequestFactory, SimpleTestCase...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/utils.py
tests/template_tests/utils.py
import os from functools import wraps from django.template.engine import Engine from django.test.utils import override_settings from django.utils.safestring import mark_safe ROOT = os.path.dirname(os.path.abspath(__file__)) TEMPLATE_DIR = os.path.join(ROOT, "templates") def setup(templates, *args, test_once=False, ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/alternate_urls.py
tests/template_tests/alternate_urls.py
from django.urls import path from . import views urlpatterns = [ # View returning a template response path("template_response_view/", views.template_response_view), # A view that can be hard to find... path("snark/", views.snark, name="snark"), ]
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/test_callables.py
tests/template_tests/test_callables.py
from unittest import TestCase from django.db.models.utils import AltersData from django.template import Context, Engine class CallableVariablesTests(TestCase): @classmethod def setUpClass(cls): cls.engine = Engine() super().setUpClass() def test_callable(self): class Doodad: ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/test_response.py
tests/template_tests/test_response.py
import pickle import time from datetime import datetime from django.template import engines from django.template.response import ( ContentNotRenderedError, SimpleTemplateResponse, TemplateResponse, ) from django.test import ( RequestFactory, SimpleTestCase, modify_settings, override_setting...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/test_loaders.py
tests/template_tests/test_loaders.py
import os.path import sys import tempfile import unittest from contextlib import contextmanager from django.template import TemplateDoesNotExist from django.template.engine import Engine from django.test import SimpleTestCase, override_settings from django.utils.functional import lazystr from .utils import TEMPLATE_D...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/__init__.py
tests/template_tests/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/broken_tag.py
tests/template_tests/broken_tag.py
from django import Xtemplate # NOQA
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false