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/check_framework/template_test_apps/same_tags_app_1/apps.py
tests/check_framework/template_test_apps/same_tags_app_1/apps.py
from django.apps import AppConfig class SameTagsApp1AppConfig(AppConfig): name = "check_framework.template_test_apps.same_tags_app_1"
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/template_test_apps/same_tags_app_1/templatetags/same_tags.py
tests/check_framework/template_test_apps/same_tags_app_1/templatetags/same_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/check_framework/template_test_apps/same_tags_app_1/templatetags/__init__.py
tests/check_framework/template_test_apps/same_tags_app_1/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/check_framework/custom_commands_app/management/commands/makemigrations.py
tests/check_framework/custom_commands_app/management/commands/makemigrations.py
from django.core.management.commands.makemigrations import ( Command as MakeMigrationsCommand, ) class Command(MakeMigrationsCommand): autodetector = int
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/urls/good_function_based_error_handlers.py
tests/check_framework/urls/good_function_based_error_handlers.py
urlpatterns = [] handler400 = __name__ + ".good_handler" handler403 = __name__ + ".good_handler" handler404 = __name__ + ".good_handler" handler500 = __name__ + ".good_handler" def good_handler(request, exception=None, foo="bar"): pass
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/urls/unique_namespaces.py
tests/check_framework/urls/unique_namespaces.py
from django.urls import include, path common_url_patterns = ( [ path("app-ns1/", include([])), path("app-url/", include([])), ], "common", ) nested_url_patterns = ( [ path("common/", include(common_url_patterns, namespace="nested")), ], "nested", ) urlpatterns = [ ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/urls/include_contains_tuple.py
tests/check_framework/urls/include_contains_tuple.py
from django.urls import include, path urlpatterns = [ path("", include([(r"^tuple/$", lambda x: x)])), ]
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/urls/contains_tuple.py
tests/check_framework/urls/contains_tuple.py
urlpatterns = [ (r"^tuple/$", lambda x: x), ]
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/urls/non_unique_namespaces.py
tests/check_framework/urls/non_unique_namespaces.py
from django.urls import include, path common_url_patterns = ( [ path("app-ns1/", include([])), path("app-url/", include([])), ], "app-ns1", ) urlpatterns = [ path("app-ns1-0/", include(common_url_patterns)), path("app-ns1-1/", include(common_url_patterns)), path("app-some-url/"...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/urls/beginning_with_slash.py
tests/check_framework/urls/beginning_with_slash.py
from django.urls import path, re_path urlpatterns = [ path("/path-starting-with-slash/", lambda x: x), re_path(r"/url-starting-with-slash/$", lambda x: x), ]
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/urls/include_with_dollar.py
tests/check_framework/urls/include_with_dollar.py
from django.urls import include, re_path urlpatterns = [ re_path("^include-with-dollar$", include([])), ]
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/urls/bad_class_based_error_handlers.py
tests/check_framework/urls/bad_class_based_error_handlers.py
urlpatterns = [] class HandlerView: @classmethod def as_view(cls): def view(): pass return view handler400 = HandlerView.as_view() handler403 = HandlerView.as_view() handler404 = HandlerView.as_view() handler500 = HandlerView.as_view()
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/urls/warning_in_include.py
tests/check_framework/urls/warning_in_include.py
from django.urls import include, path, re_path urlpatterns = [ path( "", include( [ re_path("^include-with-dollar$", include([])), ] ), ), ]
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/urls/no_warnings.py
tests/check_framework/urls/no_warnings.py
from django.urls import include, path, re_path urlpatterns = [ path("foo/", lambda x: x, name="foo"), # This dollar is ok as it is escaped re_path( r"^\$", include( [ path("bar/", lambda x: x, name="bar"), ] ), ), ]
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/urls/bad_error_handlers_invalid_path.py
tests/check_framework/urls/bad_error_handlers_invalid_path.py
urlpatterns = [] handler400 = "django.views.bad_handler" handler403 = "django.invalid_module.bad_handler" handler404 = "invalid_module.bad_handler" handler500 = "django"
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/urls/name_with_colon.py
tests/check_framework/urls/name_with_colon.py
from django.urls import re_path urlpatterns = [ re_path("^$", lambda x: x, name="name_with:colon"), ]
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/urls/no_warnings_i18n.py
tests/check_framework/urls/no_warnings_i18n.py
from django.conf.urls.i18n import i18n_patterns from django.urls import path from django.utils.translation import gettext_lazy as _ urlpatterns = i18n_patterns( path(_("translated/"), lambda x: x, name="i18n_prefixed"), )
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/urls/__init__.py
tests/check_framework/urls/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/urls/good_class_based_error_handlers.py
tests/check_framework/urls/good_class_based_error_handlers.py
from django.views.generic import View urlpatterns = [] handler400 = View.as_view() handler403 = View.as_view() handler404 = View.as_view() handler500 = View.as_view()
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/urls/cbv_as_view.py
tests/check_framework/urls/cbv_as_view.py
from django.http import HttpResponse from django.urls import path from django.views import View class EmptyCBV(View): pass class EmptyCallableView: def __call__(self, request, *args, **kwargs): return HttpResponse() urlpatterns = [ path("missing_as_view", EmptyCBV), path("has_as_view", Emp...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/urls/bad_function_based_error_handlers.py
tests/check_framework/urls/bad_function_based_error_handlers.py
urlpatterns = [] handler400 = __name__ + ".bad_handler" handler403 = __name__ + ".bad_handler" handler404 = __name__ + ".bad_handler" handler500 = __name__ + ".bad_handler" def bad_handler(): pass
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/urls/path_compatibility/contains_re_named_group.py
tests/check_framework/urls/path_compatibility/contains_re_named_group.py
from django.urls import path urlpatterns = [ path(r"(?P<named_group>\d+)", lambda x: x), ]
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/urls/path_compatibility/beginning_with_caret.py
tests/check_framework/urls/path_compatibility/beginning_with_caret.py
from django.urls import path urlpatterns = [ path("^beginning-with-caret", lambda x: x), ]
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/urls/path_compatibility/__init__.py
tests/check_framework/urls/path_compatibility/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/urls/path_compatibility/unmatched_angle_brackets.py
tests/check_framework/urls/path_compatibility/unmatched_angle_brackets.py
from django.urls import path urlpatterns = [ path("beginning-with/<angle_bracket", lambda x: x), path("ending-with/angle_bracket>", lambda x: x), path("closed_angle>/x/<opened_angle", lambda x: x), path("<mixed>angle_bracket>", lambda x: x), ]
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/urls/path_compatibility/ending_with_dollar.py
tests/check_framework/urls/path_compatibility/ending_with_dollar.py
from django.urls import path urlpatterns = [ path("ending-with-dollar$", lambda x: x), ]
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/urls/path_compatibility/matched_angle_brackets.py
tests/check_framework/urls/path_compatibility/matched_angle_brackets.py
from django.urls import path urlpatterns = [ path("<int:angle_bracket>", lambda x: x), ]
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/custom_migration_operations/operations.py
tests/custom_migration_operations/operations.py
from django.db.migrations.operations.base import Operation class TestOperation(Operation): def __init__(self): pass def deconstruct(self): return (self.__class__.__name__, [], {}) @property def reversible(self): return True def state_forwards(self, app_label, state): ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/custom_migration_operations/more_operations.py
tests/custom_migration_operations/more_operations.py
from django.db.migrations.operations.base import Operation class TestOperation(Operation): def __init__(self): pass def deconstruct(self): return (self.__class__.__name__, [], {}) @property def reversible(self): return True def state_forwards(self, app_label, state): ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/custom_migration_operations/__init__.py
tests/custom_migration_operations/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/migrations2/models.py
tests/migrations2/models.py
# Required for migration detection (#22645)
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/migrations2/__init__.py
tests/migrations2/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/migrations2/test_migrations_2_no_deps/0001_initial.py
tests/migrations2/test_migrations_2_no_deps/0001_initial.py
from django.db import migrations, models class Migration(migrations.Migration): dependencies = [] operations = [ migrations.CreateModel( "OtherAuthor", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=255)), ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/migrations2/test_migrations_2_no_deps/__init__.py
tests/migrations2/test_migrations_2_no_deps/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/migrations2/test_migrations_2_squashed_with_replaces/0001_squashed_0002.py
tests/migrations2/test_migrations_2_squashed_with_replaces/0001_squashed_0002.py
from django.db import migrations, models class Migration(migrations.Migration): replaces = [ ("migrations2", "0001_initial"), ("migrations2", "0002_second"), ] operations = [ migrations.CreateModel( "OtherAuthor", [ ("id", models.AutoField(p...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/migrations2/test_migrations_2_squashed_with_replaces/__init__.py
tests/migrations2/test_migrations_2_squashed_with_replaces/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/migrations2/test_migrations_2/0001_initial.py
tests/migrations2/test_migrations_2/0001_initial.py
from django.db import migrations, models class Migration(migrations.Migration): dependencies = [("migrations", "0002_second")] operations = [ migrations.CreateModel( "OtherAuthor", [ ("id", models.AutoField(primary_key=True)), ("name", models.Ch...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/migrations2/test_migrations_2/__init__.py
tests/migrations2/test_migrations_2/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/migrations2/test_migrations_2_first/0001_initial.py
tests/migrations2/test_migrations_2_first/0001_initial.py
from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("migrations", "__first__"), ] operations = [ migrations.CreateModel( "OtherAuthor", [ ("id", models.AutoField(primary_key=True)), ("nam...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/migrations2/test_migrations_2_first/0002_second.py
tests/migrations2/test_migrations_2_first/0002_second.py
from django.db import migrations, models class Migration(migrations.Migration): dependencies = [("migrations2", "0001_initial")] operations = [ migrations.CreateModel( "Bookstore", [ ("id", models.AutoField(primary_key=True)), ("name", models.Ch...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/migrations2/test_migrations_2_first/__init__.py
tests/migrations2/test_migrations_2_first/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/field_defaults/models.py
tests/field_defaults/models.py
""" Callable defaults You can pass callable objects as the ``default`` parameter to a field. When the object is created without an explicit value passed in, Django will call the method to determine the default value. This example uses ``datetime.datetime.now`` as the default for the ``pub_date`` field. """ from date...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/field_defaults/__init__.py
tests/field_defaults/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/field_defaults/tests.py
tests/field_defaults/tests.py
from datetime import datetime from decimal import Decimal from math import pi from django.core.exceptions import ValidationError from django.db import connection from django.db.models import Case, F, FloatField, Value, When from django.db.models.expressions import ( Expression, ExpressionList, ExpressionWr...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/mail/custombackend.py
tests/mail/custombackend.py
"""A custom backend for testing.""" from django.core.mail.backends.base import BaseEmailBackend class EmailBackend(BaseEmailBackend): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.test_outbox = [] def send_messages(self, email_messages): # Messages are s...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/mail/test_deprecated.py
tests/mail/test_deprecated.py
# RemovedInDjango70Warning: This entire file. from email.mime.text import MIMEText from django.core.mail import ( EmailAlternative, EmailAttachment, EmailMessage, EmailMultiAlternatives, ) from django.core.mail.message import forbid_multi_line_headers, sanitize_address from django.test import SimpleTes...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/mail/__init__.py
tests/mail/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/mail/test_sendtestemail.py
tests/mail/test_sendtestemail.py
from django.core import mail from django.core.management import CommandError, call_command from django.test import SimpleTestCase, override_settings @override_settings( ADMINS=["admin@example.com", "admin_and_manager@example.com"], MANAGERS=["manager@example.com", "admin_and_manager@example.com"], ) class Sen...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/mail/tests.py
tests/mail/tests.py
import ast import mimetypes import os import pickle import re import shutil import socket import sys import tempfile from datetime import datetime, timezone from email import message_from_binary_file from email import message_from_bytes as _message_from_bytes from email import policy from email.headerregistry import Ad...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
true
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/base/models.py
tests/base/models.py
from django.db import models # The models definitions below used to crash. Generating models dynamically # at runtime is a bad idea because it pollutes the app registry. This doesn't # integrate well with the test suite but at least it prevents regressions. class CustomBaseModel(models.base.ModelBase): pass cl...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/base/__init__.py
tests/base/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/settings_tests/__init__.py
tests/settings_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/settings_tests/tests.py
tests/settings_tests/tests.py
import os import sys import unittest from types import ModuleType, SimpleNamespace from unittest import mock from django.conf import ENVIRONMENT_VARIABLE, LazySettings, Settings, settings from django.core.exceptions import ImproperlyConfigured from django.http import HttpRequest from django.test import ( SimpleTes...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/m2m_intermediary/models.py
tests/m2m_intermediary/models.py
""" Many-to-many relationships via an intermediary table For many-to-many relationships that need extra fields on the intermediary table, use an intermediary model. In this example, an ``Article`` can have multiple ``Reporter`` objects, and each ``Article``-``Reporter`` combination (a ``Writer``) has a ``position`` f...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/m2m_intermediary/__init__.py
tests/m2m_intermediary/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/m2m_intermediary/tests.py
tests/m2m_intermediary/tests.py
from datetime import datetime from django.test import TestCase from .models import Article, Reporter, Writer class M2MIntermediaryTests(TestCase): def test_intermediary(self): r1 = Reporter.objects.create(first_name="John", last_name="Smith") r2 = Reporter.objects.create(first_name="Jane", last_...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/fixtures_regress/models.py
tests/fixtures_regress/models.py
from django.contrib.auth.models import User from django.db import models class Animal(models.Model): name = models.CharField(max_length=150) latin_name = models.CharField(max_length=150) count = models.IntegerField() weight = models.FloatField() # use a non-default name for the default manager ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/fixtures_regress/__init__.py
tests/fixtures_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/fixtures_regress/tests.py
tests/fixtures_regress/tests.py
# Unittests for fixtures. import json import os import unittest from io import StringIO from pathlib import Path from django.core import management, serializers from django.core.exceptions import ImproperlyConfigured from django.core.serializers.base import DeserializationError from django.db import IntegrityError, tr...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
true
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/cache/failing_cache.py
tests/cache/failing_cache.py
from django.core.cache.backends.locmem import LocMemCache class CacheClass(LocMemCache): def set(self, *args, **kwargs): raise Exception("Faked exception saving to cache") async def aset(self, *args, **kwargs): raise Exception("Faked exception saving to cache")
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/cache/models.py
tests/cache/models.py
from django.db import models from django.utils import timezone def expensive_calculation(): expensive_calculation.num_runs += 1 return timezone.now() class Poll(models.Model): question = models.CharField(max_length=200) answer = models.CharField(max_length=200) pub_date = models.DateTimeField("d...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/cache/closeable_cache.py
tests/cache/closeable_cache.py
from django.core.cache.backends.locmem import LocMemCache class CloseHookMixin: closed = False def close(self, **kwargs): self.closed = True class CacheClass(CloseHookMixin, LocMemCache): pass
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/cache/liberal_backend.py
tests/cache/liberal_backend.py
from django.core.cache.backends.locmem import LocMemCache class LiberalKeyValidationMixin: def validate_key(self, key): pass class CacheClass(LiberalKeyValidationMixin, LocMemCache): pass
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/cache/__init__.py
tests/cache/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/cache/tests.py
tests/cache/tests.py
# Unit tests for cache framework # Uses whatever cache backend is set in the test settings file. import copy import io import os import pickle import re import shutil import sys import tempfile import threading import time import unittest from functools import wraps from pathlib import Path from unittest import mock, s...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
true
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/cache/tests_async.py
tests/cache/tests_async.py
import asyncio from django.core.cache import CacheKeyWarning, cache from django.test import SimpleTestCase, override_settings from .tests import KEY_ERRORS_WITH_MEMCACHED_MSG @override_settings( CACHES={ "default": { "BACKEND": "django.core.cache.backends.dummy.DummyCache", } } )...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/admin_docs/namespace_urls.py
tests/admin_docs/namespace_urls.py
from django.contrib import admin from django.urls import include, path from . import views backend_urls = ( [ path("something/", views.XViewClass.as_view(), name="something"), ], "backend", ) urlpatterns = [ path("admin/doc/", include("django.contrib.admindocs.urls")), path("admin/", admi...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/admin_docs/views.py
tests/admin_docs/views.py
from django.contrib.admindocs.middleware import XViewMiddleware from django.http import HttpResponse from django.utils.decorators import decorator_from_middleware from django.views.generic import View xview_dec = decorator_from_middleware(XViewMiddleware) def xview(request): return HttpResponse() class XViewCl...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/admin_docs/test_utils.py
tests/admin_docs/test_utils.py
import unittest from django.contrib.admindocs.utils import ( docutils_is_available, parse_docstring, parse_rst, ) from django.test.utils import captured_stderr from .tests import AdminDocsSimpleTestCase @unittest.skipUnless(docutils_is_available, "no docutils installed.") class TestUtils(AdminDocsSimple...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/admin_docs/test_views.py
tests/admin_docs/test_views.py
import sys import unittest from django.conf import settings from django.contrib import admin from django.contrib.admindocs import utils, views from django.contrib.admindocs.views import get_return_data_type, simplify_regex from django.contrib.auth.models import Permission, User from django.contrib.contenttypes.models ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/admin_docs/models.py
tests/admin_docs/models.py
""" Models for testing various aspects of the django.contrib.admindocs app. """ from django.db import models from django.utils.functional import cached_property class Company(models.Model): name = models.CharField(max_length=200) class Group(models.Model): name = models.CharField(max_length=200) class Fa...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/admin_docs/test_middleware.py
tests/admin_docs/test_middleware.py
from django.contrib.auth.models import User from django.core.exceptions import ImproperlyConfigured from django.test import override_settings from .tests import AdminDocsTestCase, TestDataMixin class XViewMiddlewareTest(TestDataMixin, AdminDocsTestCase): def test_xview_func(self): user = User.objects.get...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/admin_docs/__init__.py
tests/admin_docs/__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_docs/tests.py
tests/admin_docs/tests.py
from django.contrib.auth.models import User from django.test import SimpleTestCase, TestCase, modify_settings, override_settings class TestDataMixin: @classmethod def setUpTestData(cls): cls.superuser = User.objects.create_superuser( username="super", password="secret", email="super@exampl...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/admin_docs/urls.py
tests/admin_docs/urls.py
from django.contrib import admin from django.urls import include, path from . import views ns_patterns = ( [ path("xview/func/", views.xview_dec(views.xview), name="func"), ], "test", ) urlpatterns = [ path("admin/", admin.site.urls), path("admindocs/", include("django.contrib.admindocs.u...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/ordering/models.py
tests/ordering/models.py
""" Specifying ordering Specify default ordering for a model using the ``ordering`` attribute, which should be a list or tuple of field names. This tells Django how to order ``QuerySet`` results. If a field name in ``ordering`` starts with a hyphen, that field will be ordered in descending order. Otherwise, it'll be ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/ordering/__init__.py
tests/ordering/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/ordering/tests.py
tests/ordering/tests.py
from datetime import datetime from operator import attrgetter from django.core.exceptions import FieldError from django.db.models import ( Case, CharField, Count, DateTimeField, F, IntegerField, Max, OrderBy, OuterRef, Subquery, Value, When, ) from django.db.models.funct...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/get_earliest_or_latest/models.py
tests/get_earliest_or_latest/models.py
from django.db import models class Article(models.Model): headline = models.CharField(max_length=100) pub_date = models.DateField() expire_date = models.DateField() class Meta: get_latest_by = "pub_date" class Person(models.Model): name = models.CharField(max_length=30) birthday = m...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/get_earliest_or_latest/__init__.py
tests/get_earliest_or_latest/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/get_earliest_or_latest/tests.py
tests/get_earliest_or_latest/tests.py
from datetime import datetime from django.db.models import Avg from django.test import TestCase from .models import Article, Comment, IndexErrorArticle, Person class EarliestOrLatestTests(TestCase): """Tests for the earliest() and latest() objects methods""" @classmethod def setUpClass(cls): su...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/introspection/models.py
tests/introspection/models.py
from django.db import models class City(models.Model): id = models.BigAutoField(primary_key=True) name = models.CharField(max_length=50) class Country(models.Model): id = models.SmallAutoField(primary_key=True) name = models.CharField(max_length=50) class District(models.Model): city = models....
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/introspection/__init__.py
tests/introspection/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/introspection/tests.py
tests/introspection/tests.py
from django.db import DatabaseError, connection from django.db.models import DB_CASCADE, DB_SET_DEFAULT, DB_SET_NULL, DO_NOTHING, Index from django.test import TransactionTestCase, skipUnlessDBFeature from .models import ( Article, ArticleReporter, CheckConstraintModel, City, Comment, Country, ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/proxy_models/admin.py
tests/proxy_models/admin.py
from django.contrib import admin from .models import ProxyTrackerUser, TrackerUser site = admin.AdminSite(name="admin_proxy") site.register(TrackerUser) site.register(ProxyTrackerUser)
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/proxy_models/models.py
tests/proxy_models/models.py
""" By specifying the 'proxy' Meta attribute, model subclasses can specify that they will take data directly from the table of their base class table rather than using a new table of their own. This allows them to act as simple proxies, providing a modified interface to the data from the base class. """ from django.db...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/proxy_models/__init__.py
tests/proxy_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/proxy_models/tests.py
tests/proxy_models/tests.py
from django.contrib import admin from django.contrib.auth.models import User as AuthUser from django.contrib.contenttypes.models import ContentType from django.core import checks, management from django.db import DEFAULT_DB_ALIAS, models from django.db.models import signals from django.test import TestCase, override_se...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/proxy_models/urls.py
tests/proxy_models/urls.py
from django.urls import path from .admin import site urlpatterns = [ path("admin/", site.urls), ]
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/force_insert_update/models.py
tests/force_insert_update/models.py
""" Tests for forcing insert and update queries (instead of Django's normal automatic behavior). """ from django.db import models class Counter(models.Model): name = models.CharField(max_length=10) value = models.IntegerField() class InheritedCounter(Counter): tag = models.CharField(max_length=10) cl...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/force_insert_update/__init__.py
tests/force_insert_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/force_insert_update/tests.py
tests/force_insert_update/tests.py
from django.core.exceptions import ObjectNotUpdated from django.db import DatabaseError, IntegrityError, models, transaction from django.test import TestCase from .models import ( Counter, DiamondSubSubCounter, InheritedCounter, OtherSubCounter, ProxyCounter, SubCounter, SubSubCounter, ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/bash_completion/__init__.py
tests/bash_completion/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/bash_completion/tests.py
tests/bash_completion/tests.py
""" A series of tests to establish that the command-line bash completion works. """ import os import sys import unittest from django.apps import apps from django.core.management import ManagementUtility from django.test.utils import captured_stdout class BashCompletionTests(unittest.TestCase): """ Testing t...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/bash_completion/management/__init__.py
tests/bash_completion/management/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/bash_completion/management/commands/test_command.py
tests/bash_completion/management/commands/test_command.py
from django.core.management.base import BaseCommand class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument("--list", action="store_true", help="Print all options") def handle(self, *args, **options): pass
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/bash_completion/management/commands/__init__.py
tests/bash_completion/management/commands/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/custom_columns/models.py
tests/custom_columns/models.py
""" Custom column/table names If your database column name is different than your model attribute, use the ``db_column`` parameter. Note that you'll use the field's name, not its column name, in API usage. If your database table name is different than your model name, use the ``db_table`` Meta attribute. This has no ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/custom_columns/__init__.py
tests/custom_columns/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/custom_columns/tests.py
tests/custom_columns/tests.py
from django.core.exceptions import FieldError from django.test import TestCase from .models import Article, Author class CustomColumnsTests(TestCase): @classmethod def setUpTestData(cls): cls.a1 = Author.objects.create(first_name="John", last_name="Smith") cls.a2 = Author.objects.create(first...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false