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/i18n/project_dir/app_no_locale/models.py
tests/i18n/project_dir/app_no_locale/models.py
from django.utils.translation import gettext as _ string = _("This app has no locale directory")
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/i18n/project_dir/app_no_locale/__init__.py
tests/i18n/project_dir/app_no_locale/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/i18n/project_dir/app_with_locale/models.py
tests/i18n/project_dir/app_with_locale/models.py
from django.utils.translation import gettext as _ string = _("This app has a locale directory")
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/i18n/project_dir/app_with_locale/__init__.py
tests/i18n/project_dir/app_with_locale/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/i18n/other/__init__.py
tests/i18n/other/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/i18n/other/locale/__init__.py
tests/i18n/other/locale/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/i18n/other/locale/de/formats.py
tests/i18n/other/locale/de/formats.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/i18n/other/locale/de/__init__.py
tests/i18n/other/locale/de/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/i18n/other/locale/fr/formats.py
tests/i18n/other/locale/fr/formats.py
# A user-defined format CUSTOM_DAY_FORMAT = "d/m/Y CUSTOM"
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/i18n/other/locale/fr/__init__.py
tests/i18n/other/locale/fr/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/i18n/resolution/__init__.py
tests/i18n/resolution/__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_inlines/admin.py
tests/admin_inlines/admin.py
from django import forms from django.contrib import admin from django.core.exceptions import ValidationError from django.db import models from .models import ( Author, BinaryTree, CapoFamiglia, Chapter, Child, ChildModel1, ChildModel2, Class, Consigliere, Course, CourseProxy...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/admin_inlines/models.py
tests/admin_inlines/models.py
""" Testing of admin inline formsets. """ import random import uuid from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.models import ContentType from django.core.exceptions import ValidationError from django.db import models class Parent(models.Model): name = model...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/admin_inlines/__init__.py
tests/admin_inlines/__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_inlines/tests.py
tests/admin_inlines/tests.py
from django.contrib.admin import ModelAdmin, TabularInline from django.contrib.admin.helpers import InlineAdminForm from django.contrib.admin.tests import AdminSeleniumTestCase from django.contrib.auth.models import Permission, User from django.contrib.contenttypes.models import ContentType from django.test import Requ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
true
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/admin_inlines/test_templates.py
tests/admin_inlines/test_templates.py
import json from django.template.loader import render_to_string from django.test import SimpleTestCase class TestTemplates(SimpleTestCase): def test_javascript_escaping(self): context = { "inline_admin_formset": { "inline_formset_data": json.dumps( { ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/admin_inlines/urls.py
tests/admin_inlines/urls.py
from django.urls import path from . import admin urlpatterns = [ path("admin/", admin.site.urls), path("admin2/", admin.site2.urls), path("admin3/", admin.site3.urls), path("admin4/", admin.site4.urls), ]
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/builtin_server/views.py
tests/builtin_server/views.py
from io import BytesIO from django.http import FileResponse FILE_RESPONSE_HOLDER = {} def file_response(request): f1 = BytesIO(b"test1") f2 = BytesIO(b"test2") response = FileResponse(f1) response._resource_closers.append(f2.close) FILE_RESPONSE_HOLDER["response"] = response FILE_RESPONSE_HO...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/builtin_server/__init__.py
tests/builtin_server/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/builtin_server/tests.py
tests/builtin_server/tests.py
import sys import traceback from io import BytesIO from unittest import TestCase, mock from wsgiref import simple_server from django.core.servers.basehttp import get_internal_wsgi_application from django.core.signals import request_finished from django.test import RequestFactory, override_settings from .views import ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/builtin_server/urls.py
tests/builtin_server/urls.py
from django.urls import path from . import views urlpatterns = [ path("fileresponse/", views.file_response), ]
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/contenttypes_tests/test_operations.py
tests/contenttypes_tests/test_operations.py
from django.apps.registry import apps from django.conf import settings from django.contrib.contenttypes import management as contenttypes_management from django.contrib.contenttypes.models import ContentType from django.core.management import call_command from django.db import migrations, models from django.test import...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/contenttypes_tests/test_checks.py
tests/contenttypes_tests/test_checks.py
from unittest import mock from django.contrib.contenttypes.checks import check_model_name_lengths from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.core import checks from django.db import models from django.test imp...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/contenttypes_tests/test_views.py
tests/contenttypes_tests/test_views.py
import datetime from unittest import mock from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.views import shortcut from django.contrib.sites.models import Site from django.contrib.sites.shortcuts import get_current_site from django.http import Http404, HttpRequest from django.t...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/contenttypes_tests/models.py
tests/contenttypes_tests/models.py
import uuid from urllib.parse import quote from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.contrib.sites.models import SiteManager from django.db import models class Site(models.Model): domain = models.CharFi...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/contenttypes_tests/test_migrations.py
tests/contenttypes_tests/test_migrations.py
from importlib import import_module from django.apps import apps from django.contrib.auth.models import Permission from django.contrib.contenttypes.models import ContentType from django.db import DEFAULT_DB_ALIAS, connections from django.test import TransactionTestCase remove_content_type_name = import_module( "d...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/contenttypes_tests/test_management.py
tests/contenttypes_tests/test_management.py
from unittest import mock from django.apps.registry import Apps, apps from django.contrib.contenttypes import management as contenttypes_management from django.contrib.contenttypes.models import ContentType from django.core.management import call_command from django.test import TestCase, modify_settings 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/contenttypes_tests/test_models.py
tests/contenttypes_tests/test_models.py
from django.apps import apps from django.contrib.contenttypes.models import ContentType, ContentTypeManager from django.contrib.contenttypes.prefetch import GenericPrefetch from django.db import models from django.db.migrations.state import ModelState, ProjectState from django.test import TestCase, override_settings fr...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/contenttypes_tests/test_fields.py
tests/contenttypes_tests/test_fields.py
import json from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.prefetch import GenericPrefetch from django.db import models from django.test import TestCase from django.test.utils import isolate_apps from .models import Answer, Post, Question @isolate_apps("contenttype...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/contenttypes_tests/__init__.py
tests/contenttypes_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/contenttypes_tests/test_order_with_respect_to.py
tests/contenttypes_tests/test_order_with_respect_to.py
from order_with_respect_to.base_tests import BaseOrderWithRespectToTests from django.test import TestCase from .models import Answer, Post, Question class OrderWithRespectToGFKTests(BaseOrderWithRespectToTests, TestCase): Answer = Answer Post = Post Question = Question
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/contenttypes_tests/urls.py
tests/contenttypes_tests/urls.py
from django.contrib.contenttypes import views from django.urls import re_path urlpatterns = [ re_path(r"^shortcut/([0-9]+)/(.*)/$", views.shortcut), ]
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/contenttypes_tests/operations_migrations/0001_initial.py
tests/contenttypes_tests/operations_migrations/0001_initial.py
from django.db import migrations, models class Migration(migrations.Migration): operations = [ migrations.CreateModel( "Foo", [ ("id", models.AutoField(primary_key=True)), ], ), ]
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/contenttypes_tests/operations_migrations/__init__.py
tests/contenttypes_tests/operations_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/contenttypes_tests/operations_migrations/0002_rename_foo.py
tests/contenttypes_tests/operations_migrations/0002_rename_foo.py
from django.db import migrations def assert_foo_contenttype_not_cached(apps, schema_editor): ContentType = apps.get_model("contenttypes", "ContentType") try: content_type = ContentType.objects.get_by_natural_key( "contenttypes_tests", "foo" ) except ContentType.DoesNotExist: ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_forms/test_uuid.py
tests/model_forms/test_uuid.py
from django import forms from django.core.exceptions import ValidationError from django.test import TestCase from .models import UUIDPK class UUIDPKForm(forms.ModelForm): class Meta: model = UUIDPK fields = "__all__" class ModelFormBaseTest(TestCase): def test_create_save_error(self): ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_forms/models.py
tests/model_forms/models.py
import datetime import os import tempfile import uuid from django.core import validators from django.core.exceptions import ValidationError from django.core.files.storage import FileSystemStorage from django.db import models temp_storage_dir = tempfile.mkdtemp() temp_storage = FileSystemStorage(temp_storage_dir) cl...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_forms/__init__.py
tests/model_forms/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_forms/tests.py
tests/model_forms/tests.py
import datetime import os import shutil from decimal import Decimal from unittest import mock, skipUnless from django import forms from django.core.exceptions import ( NON_FIELD_ERRORS, FieldError, ImproperlyConfigured, ValidationError, ) from django.core.files.uploadedfile import SimpleUploadedFile fr...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
true
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_forms/test_modelchoicefield.py
tests/model_forms/test_modelchoicefield.py
import datetime from django import forms from django.core.exceptions import ValidationError from django.forms.models import ModelChoiceIterator, ModelChoiceIteratorValue from django.forms.widgets import CheckboxSelectMultiple from django.template import Context, Template from django.test import TestCase from .models ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/proxy_model_inheritance/models.py
tests/proxy_model_inheritance/models.py
from django.db import models class ConcreteModel(models.Model): pass class ProxyModel(ConcreteModel): class Meta: proxy = True class ConcreteModelSubclass(ProxyModel): pass class ConcreteModelSubclassProxy(ConcreteModelSubclass): class Meta: proxy = True
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/proxy_model_inheritance/__init__.py
tests/proxy_model_inheritance/__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_model_inheritance/tests.py
tests/proxy_model_inheritance/tests.py
import os from django.core.management import call_command from django.test import TestCase, TransactionTestCase from django.test.utils import extend_sys_path from .models import ( ConcreteModel, ConcreteModelSubclass, ConcreteModelSubclassProxy, ProxyModel, ) class ProxyModelInheritanceTests(Transac...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/proxy_model_inheritance/app2/models.py
tests/proxy_model_inheritance/app2/models.py
from django.db import models class NiceModel(models.Model): pass
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/proxy_model_inheritance/app2/__init__.py
tests/proxy_model_inheritance/app2/__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_model_inheritance/app1/models.py
tests/proxy_model_inheritance/app1/models.py
from app2.models import NiceModel class ProxyModel(NiceModel): class Meta: proxy = True
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/proxy_model_inheritance/app1/__init__.py
tests/proxy_model_inheritance/app1/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/redirects_tests/__init__.py
tests/redirects_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/redirects_tests/tests.py
tests/redirects_tests/tests.py
from django.conf import settings from django.contrib.redirects.middleware import RedirectFallbackMiddleware from django.contrib.redirects.models import Redirect from django.contrib.sites.models import Site from django.core.exceptions import ImproperlyConfigured from django.http import HttpResponse, HttpResponseForbidde...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/redirects_tests/urls.py
tests/redirects_tests/urls.py
from django.http import HttpResponse from django.urls import path urlpatterns = [ path("", lambda req: HttpResponse("OK")), ]
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/async/test_async_queryset.py
tests/async/test_async_queryset.py
import json import xml.etree.ElementTree from datetime import datetime from asgiref.sync import async_to_sync, sync_to_async from django.db import NotSupportedError, connection from django.db.models import Prefetch, Sum from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature from .models import Relate...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/async/test_async_model_methods.py
tests/async/test_async_model_methods.py
from django.test import TestCase from .models import SimpleModel class AsyncModelOperationTest(TestCase): @classmethod def setUpTestData(cls): cls.s1 = SimpleModel.objects.create(field=0) async def test_asave(self): self.s1.field = 10 await self.s1.asave() refetched = awa...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/async/models.py
tests/async/models.py
from django.db import models from django.utils import timezone class RelatedModel(models.Model): simple = models.ForeignKey("SimpleModel", models.CASCADE, null=True) class SimpleModel(models.Model): field = models.IntegerField() created = models.DateTimeField(default=timezone.now) class ManyToManyMode...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/async/test_async_shortcuts.py
tests/async/test_async_shortcuts.py
from django.db.models import Q from django.http import Http404 from django.shortcuts import aget_list_or_404, aget_object_or_404 from django.test import TestCase from .models import RelatedModel, SimpleModel class GetListObjectOr404Test(TestCase): @classmethod def setUpTestData(cls): cls.s1 = SimpleM...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/async/test_async_related_managers.py
tests/async/test_async_related_managers.py
from django.test import TestCase from .models import ManyToManyModel, RelatedModel, SimpleModel class AsyncRelatedManagersOperationTest(TestCase): @classmethod def setUpTestData(cls): cls.mtm1 = ManyToManyModel.objects.create() cls.s1 = SimpleModel.objects.create(field=0) cls.mtm2 = M...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/async/test_async_auth.py
tests/async/test_async_auth.py
from django.contrib.auth import ( aauthenticate, aget_user, alogin, alogout, aupdate_session_auth_hash, ) from django.contrib.auth.models import AnonymousUser, User from django.http import HttpRequest from django.test import TestCase, override_settings class AsyncAuthTest(TestCase): @classmeth...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/async/__init__.py
tests/async/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/async/tests.py
tests/async/tests.py
import asyncio import os from unittest import mock from asgiref.sync import async_to_sync, iscoroutinefunction from django.core.cache import DEFAULT_CACHE_ALIAS, caches from django.core.exceptions import ImproperlyConfigured, SynchronousOnlyOperation from django.http import HttpResponse, HttpResponseNotAllowed from d...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/unmanaged_models/models.py
tests/unmanaged_models/models.py
""" Models can have a ``managed`` attribute, which specifies whether the SQL code is generated for the table on various manage.py operations. """ from django.db import models # All of these models are created in the database by Django. class A01(models.Model): f_a = models.CharField(max_length=10, db_index=True...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/unmanaged_models/__init__.py
tests/unmanaged_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/unmanaged_models/tests.py
tests/unmanaged_models/tests.py
from django.db import connection from django.test import TestCase from .models import A01, A02, B01, B02, C01, C02, Managed1, Unmanaged2 class SimpleTests(TestCase): def test_simple(self): """ The main test here is that the all the models can be created without any database errors. We can...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/test_runner/test_shuffler.py
tests/test_runner/test_shuffler.py
from unittest import mock from django.test import SimpleTestCase from django.test.runner import Shuffler class ShufflerTests(SimpleTestCase): def test_hash_text(self): actual = Shuffler._hash_text("abcd") self.assertEqual(actual, "e2fc714c4727ee9395f324cd2e7f331f") def test_hash_text_hash_al...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/test_runner/runner.py
tests/test_runner/runner.py
from django.test.runner import DiscoverRunner class CustomOptionsTestRunner(DiscoverRunner): def __init__( self, verbosity=1, interactive=True, failfast=True, option_a=None, option_b=None, option_c=None, **kwargs, ): super().__init__( ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/test_runner/test_debug_sql.py
tests/test_runner/test_debug_sql.py
import logging import unittest from io import StringIO from time import time from unittest import mock from django.db import DEFAULT_DB_ALIAS, connection, connections from django.test import TestCase from django.test.runner import DiscoverRunner, QueryFormatter from .models import Person logger = logging.getLogger(_...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/test_runner/test_parallel.py
tests/test_runner/test_parallel.py
import pickle import sys import unittest from unittest.case import TestCase from unittest.result import TestResult from unittest.suite import TestSuite, _ErrorHolder from django.test import SimpleTestCase from django.test.runner import ParallelTestSuite, RemoteTestResult from . import models try: import tblib.pi...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/test_runner/test_discover_runner.py
tests/test_runner/test_discover_runner.py
import logging import multiprocessing import os import unittest.loader from argparse import ArgumentParser from contextlib import contextmanager from importlib import import_module from unittest import TestSuite, TextTestRunner, defaultTestLoader, mock from django.db import connections from django.test import SimpleTe...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
true
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/test_runner/models.py
tests/test_runner/models.py
from django.db import models class Person(models.Model): first_name = models.CharField(max_length=20) last_name = models.CharField(max_length=20) friends = models.ManyToManyField("self") system_check_run_count = 0 @classmethod def check(cls, *args, **kwargs): cls.system_check_run_cou...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/test_runner/__init__.py
tests/test_runner/__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_runner/tests.py
tests/test_runner/tests.py
""" Tests for django test runner """ import collections.abc import functools import multiprocessing import os import sys import unittest from unittest import mock from admin_scripts.tests import AdminScriptTestCase from django import db from django.conf import settings from django.core.exceptions import ImproperlyCo...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
true
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/files/__init__.py
tests/files/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/files/tests.py
tests/files/tests.py
import errno import gzip import os import struct import tempfile import unittest from io import BytesIO, StringIO, TextIOWrapper from pathlib import Path from unittest import mock from django.core.files import File, locks from django.core.files.base import ContentFile from django.core.files.move import file_move_safe ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/db_typecasts/__init__.py
tests/db_typecasts/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/db_typecasts/tests.py
tests/db_typecasts/tests.py
# Unit tests for typecast functions in django.db.backends.util import datetime import unittest from django.db.backends import utils as typecasts TEST_CASES = { "typecast_date": ( ("", None), (None, None), ("2005-08-11", datetime.date(2005, 8, 11)), ("1990-01-01", datetime.date(199...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/migration_test_data_persistence/models.py
tests/migration_test_data_persistence/models.py
from django.db import models class Book(models.Model): title = models.CharField(max_length=100) class Unmanaged(models.Model): title = models.CharField(max_length=100) class Meta: managed = False
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/migration_test_data_persistence/__init__.py
tests/migration_test_data_persistence/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/migration_test_data_persistence/tests.py
tests/migration_test_data_persistence/tests.py
from django.core.management import call_command from django.test import TestCase, TransactionTestCase from .models import Book class MigrationDataPersistenceTestCase(TransactionTestCase): """ Data loaded in migrations is available if TransactionTestCase.serialized_rollback = True. """ available_...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/migration_test_data_persistence/migrations/0001_initial.py
tests/migration_test_data_persistence/migrations/0001_initial.py
from django.db import migrations, models class Migration(migrations.Migration): dependencies = [] operations = [ migrations.CreateModel( name="Book", fields=[ ( "id", models.AutoField( verbose_name...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/migration_test_data_persistence/migrations/0002_add_book.py
tests/migration_test_data_persistence/migrations/0002_add_book.py
from django.db import migrations def add_book(apps, schema_editor): apps.get_model("migration_test_data_persistence", "Book").objects.using( schema_editor.connection.alias, ).create( title="I Love Django", ) class Migration(migrations.Migration): dependencies = [("migration_test_data...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/migration_test_data_persistence/migrations/__init__.py
tests/migration_test_data_persistence/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/properties/models.py
tests/properties/models.py
""" Using properties on models Use properties on models just like on any other Python object. """ from django.db import models class Person(models.Model): first_name = models.CharField(max_length=30) last_name = models.CharField(max_length=30) def _get_full_name(self): return "%s %s" % (self.fi...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/properties/__init__.py
tests/properties/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/properties/tests.py
tests/properties/tests.py
from django.test import TestCase from .models import Person class PropertyTests(TestCase): @classmethod def setUpTestData(cls): cls.a = Person.objects.create(first_name="John", last_name="Lennon") def test_getter(self): self.assertEqual(self.a.full_name, "John Lennon") def test_sett...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_fields/test_uuid.py
tests/model_fields/test_uuid.py
import json import uuid from django.core import exceptions, serializers from django.db import IntegrityError, connection, models from django.db.models import CharField, F, Value from django.db.models.functions import Concat, Repeat from django.test import ( SimpleTestCase, TestCase, TransactionTestCase, ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_fields/test_genericipaddressfield.py
tests/model_fields/test_genericipaddressfield.py
from django.core.exceptions import ValidationError from django.db import models from django.test import TestCase from .models import GenericIPAddress class GenericIPAddressFieldTests(TestCase): def test_genericipaddressfield_formfield_protocol(self): """ GenericIPAddressField with a specified pro...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_fields/test_durationfield.py
tests/model_fields/test_durationfield.py
import datetime import json from django import forms from django.core import exceptions, serializers from django.db import models from django.test import SimpleTestCase, TestCase from .models import DurationModel, NullDurationModel class TestSaveLoad(TestCase): def test_simple_roundtrip(self): duration ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_fields/test_jsonfield.py
tests/model_fields/test_jsonfield.py
import operator import uuid from unittest import mock from django import forms from django.core import serializers from django.core.exceptions import ValidationError from django.core.serializers.json import DjangoJSONEncoder from django.db import ( DataError, IntegrityError, NotSupportedError, Operatio...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
true
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_fields/test_foreignkey.py
tests/model_fields/test_foreignkey.py
from decimal import Decimal from django.apps import apps from django.core import checks from django.core.exceptions import FieldError from django.db import models from django.test import TestCase, skipIfDBFeature from django.test.utils import isolate_apps from .models import Bar, FkToChar, Foo, PrimaryKeyCharModel ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_fields/test_generatedfield.py
tests/model_fields/test_generatedfield.py
import uuid from decimal import Decimal from django.apps import apps from django.core.exceptions import ValidationError from django.db import IntegrityError, connection from django.db.models import ( CharField, F, FloatField, GeneratedField, IntegerField, Model, ) from django.db.models.function...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_fields/test_autofield.py
tests/model_fields/test_autofield.py
from django.db import models from django.test import SimpleTestCase from .models import AutoModel, BigAutoModel, SmallAutoModel from .test_integerfield import ( BigIntegerFieldTests, IntegerFieldTests, SmallIntegerFieldTests, ) class AutoFieldTests(IntegerFieldTests): model = AutoModel rel_db_typ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_fields/test_manytomanyfield.py
tests/model_fields/test_manytomanyfield.py
from django.apps import apps from django.db import models from django.test import SimpleTestCase, TestCase from django.test.utils import isolate_apps from .models import ManyToMany class ManyToManyFieldTests(SimpleTestCase): def test_abstract_model_pending_operations(self): """ Many-to-many field...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_fields/storage.py
tests/model_fields/storage.py
from django.core.files.storage.filesystem import FileSystemStorage class NoReadFileSystemStorage(FileSystemStorage): def open(self, *args, **kwargs): raise AssertionError("This storage class does not support reading.")
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_fields/test_booleanfield.py
tests/model_fields/test_booleanfield.py
from django import forms from django.core.exceptions import ValidationError from django.db import IntegrityError, models, transaction from django.test import SimpleTestCase, TestCase from .models import BooleanModel, FksToBooleans, NullBooleanModel class BooleanFieldTests(TestCase): def _test_get_prep_value(self...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_fields/test_slugfield.py
tests/model_fields/test_slugfield.py
from django.test import TestCase from .models import BigS, UnicodeSlugField class SlugFieldTests(TestCase): def test_slugfield_max_length(self): """ SlugField honors max_length. """ bs = BigS.objects.create(s="slug" * 50) bs = BigS.objects.get(pk=bs.pk) self.assert...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_fields/models.py
tests/model_fields/models.py
import json import tempfile import uuid from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.core.files.storage import FileSystemStorage from django.core.serializers.json import DjangoJSONEncoder from django.db import c...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_fields/test_datetimefield.py
tests/model_fields/test_datetimefield.py
import datetime from django.db import models from django.test import SimpleTestCase, TestCase, override_settings, skipUnlessDBFeature from django.test.utils import requires_tz_support from django.utils import timezone from .models import DateTimeModel class DateTimeFieldTests(TestCase): def test_datetimefield_t...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_fields/test_promises.py
tests/model_fields/test_promises.py
import datetime from decimal import Decimal from django.db.models import ( AutoField, BinaryField, BooleanField, CharField, DateField, DateTimeField, DecimalField, EmailField, FileField, FilePathField, FloatField, GenericIPAddressField, ImageField, IntegerField, ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_fields/test_binaryfield.py
tests/model_fields/test_binaryfield.py
from django.core.exceptions import ValidationError from django.db import models from django.test import TestCase from .models import DataModel class BinaryFieldTests(TestCase): binary_data = b"\x00\x46\xfe" def test_set_and_retrieve(self): data_set = ( self.binary_data, bytea...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_fields/test_integerfield.py
tests/model_fields/test_integerfield.py
from unittest import SkipTest from django.core import validators from django.core.exceptions import ValidationError from django.db import IntegrityError, connection, models from django.test import SimpleTestCase, TestCase from .models import ( BigIntegerModel, IntegerModel, PositiveBigIntegerModel, Po...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_fields/test_filepathfield.py
tests/model_fields/test_filepathfield.py
import os from django.db.models import FilePathField from django.test import SimpleTestCase class FilePathFieldTests(SimpleTestCase): def test_path(self): path = os.path.dirname(__file__) field = FilePathField(path=path) self.assertEqual(field.path, path) self.assertEqual(field.fo...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_fields/test_charfield.py
tests/model_fields/test_charfield.py
from django.core.exceptions import ValidationError from django.db import models from django.test import SimpleTestCase, TestCase from .models import Post class TestCharField(TestCase): def test_max_length_passed_to_formfield(self): """ CharField passes its max_length attribute to form fields crea...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false