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/postgres_tests/migrations/0002_create_test_models.py
tests/postgres_tests/migrations/0002_create_test_models.py
from django.db import migrations, models from ..fields import ( ArrayField, BigIntegerRangeField, DateRangeField, DateTimeRangeField, DecimalRangeField, EnumField, HStoreField, IntegerRangeField, OffByOneField, SearchVectorField, ) from ..models import TagField class Migration...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/admin_widgets/test_autocomplete_widget.py
tests/admin_widgets/test_autocomplete_widget.py
from django import forms from django.contrib import admin from django.contrib.admin.widgets import AutocompleteSelect from django.forms import ModelChoiceField from django.test import TestCase, override_settings from django.utils import translation from .models import Album, Band, ReleaseEvent, VideoStream class Alb...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/admin_widgets/models.py
tests/admin_widgets/models.py
import tempfile import uuid from django.contrib.auth.models import User from django.core.files.storage import FileSystemStorage from django.db import models try: from PIL import Image except ImportError: Image = None else: temp_storage_dir = tempfile.mkdtemp() temp_storage = FileSystemStorage(temp_sto...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/admin_widgets/__init__.py
tests/admin_widgets/__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_widgets/tests.py
tests/admin_widgets/tests.py
import gettext import os import re import zoneinfo from datetime import datetime, timedelta from importlib import import_module from pathlib import Path from unittest import skipUnless from django import forms from django.conf import settings from django.contrib import admin from django.contrib.admin import widgets fr...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
true
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/admin_widgets/widgetadmin.py
tests/admin_widgets/widgetadmin.py
from django.contrib import admin from .models import ( Advisor, Album, Band, Bee, Car, CarTire, Event, Inventory, Member, Profile, ReleaseEvent, School, Student, User, VideoStream, ) class WidgetAdmin(admin.AdminSite): pass class CarAdmin(admin.ModelA...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/admin_widgets/urls.py
tests/admin_widgets/urls.py
from django.urls import path from . import widgetadmin urlpatterns = [ path("", widgetadmin.site.urls), ]
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/mutually_referential/models.py
tests/mutually_referential/models.py
""" Mutually referential many-to-one relationships Strings can be used instead of model literals to set up "lazy" relations. """ from django.db import models class Parent(models.Model): name = models.CharField(max_length=100) # Use a simple string for forward declarations. bestchild = models.ForeignKey...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/mutually_referential/__init__.py
tests/mutually_referential/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/mutually_referential/tests.py
tests/mutually_referential/tests.py
from django.test import TestCase from .models import Parent class MutuallyReferentialTests(TestCase): def test_mutually_referential(self): # Create a Parent q = Parent(name="Elizabeth") q.save() # Create some children c = q.child_set.create(name="Charles") q.child...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_regress/models.py
tests/model_regress/models.py
from django.db import models class Article(models.Model): CHOICES = ( (1, "first"), (2, "second"), ) headline = models.CharField(max_length=100, default="Default headline") pub_date = models.DateTimeField() status = models.IntegerField(blank=True, null=True, choices=CHOICES) mi...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_regress/test_state.py
tests/model_regress/test_state.py
import gc from django.db.models.base import ModelState, ModelStateFieldsCacheDescriptor from django.test import SimpleTestCase from django.test.utils import garbage_collect from .models import Worker, WorkerProfile class ModelStateTests(SimpleTestCase): def test_fields_cache_descriptor(self): self.asser...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_regress/__init__.py
tests/model_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/model_regress/tests.py
tests/model_regress/tests.py
import copy import datetime from operator import attrgetter from django.core.exceptions import ValidationError from django.db import models, router from django.db.models.sql import InsertQuery from django.test import TestCase, skipUnlessDBFeature from django.test.utils import isolate_apps from django.utils.timezone im...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_regress/test_pickle.py
tests/model_regress/test_pickle.py
import pickle import django from django.db import DJANGO_VERSION_PICKLE_KEY, models from django.test import SimpleTestCase class ModelPickleTests(SimpleTestCase): def test_missing_django_version_unpickling(self): """ #21430 -- Verifies a warning is raised for models that are unpickled wit...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/m2o_recursive/models.py
tests/m2o_recursive/models.py
""" Relating an object to itself, many-to-one To define a many-to-one relationship between a model and itself, use ``ForeignKey('self', ...)``. In this example, a ``Category`` is related to itself. That is, each ``Category`` has a parent ``Category``. Set ``related_name`` to designate what the reverse relationship i...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/m2o_recursive/__init__.py
tests/m2o_recursive/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/m2o_recursive/tests.py
tests/m2o_recursive/tests.py
from django.test import TestCase from .models import Category, Person class ManyToOneRecursiveTests(TestCase): @classmethod def setUpTestData(cls): cls.r = Category.objects.create(id=None, name="Root category", parent=None) cls.c = Category.objects.create(id=None, name="Child category", paren...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/fixtures_model_package/__init__.py
tests/fixtures_model_package/__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_model_package/tests.py
tests/fixtures_model_package/tests.py
from django.core import management from django.core.management import CommandError from django.test import TestCase from .models import Article class SampleTestCase(TestCase): fixtures = ["model_package_fixture1.json", "model_package_fixture2.json"] def test_class_fixtures(self): "Test cases can loa...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/fixtures_model_package/models/__init__.py
tests/fixtures_model_package/models/__init__.py
from django.db import models class Article(models.Model): headline = models.CharField(max_length=100, default="Default headline") pub_date = models.DateTimeField() class Meta: app_label = "fixtures_model_package" ordering = ("-pub_date", "headline") def __str__(self): return ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/annotations/models.py
tests/annotations/models.py
from django.db import models class Author(models.Model): name = models.CharField(max_length=100) age = models.IntegerField() friends = models.ManyToManyField("self", blank=True) class Publisher(models.Model): name = models.CharField(max_length=255) num_awards = models.IntegerField() class Book...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/annotations/__init__.py
tests/annotations/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/annotations/tests.py
tests/annotations/tests.py
import datetime from decimal import Decimal from unittest import skipUnless from django.core.exceptions import FieldDoesNotExist, FieldError from django.db import connection from django.db.models import ( BooleanField, Case, CharField, Count, DateTimeField, DecimalField, Exists, Express...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
true
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/staticfiles_tests/test_checks.py
tests/staticfiles_tests/test_checks.py
from pathlib import Path from unittest import mock from django.conf import DEFAULT_STORAGE_ALIAS, STATICFILES_STORAGE_ALIAS, settings from django.contrib.staticfiles.checks import E005, check_finders, check_storages from django.contrib.staticfiles.finders import BaseFinder, get_finder from django.core.checks import Er...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/staticfiles_tests/test_finders.py
tests/staticfiles_tests/test_finders.py
import os from django.conf import settings from django.contrib.staticfiles import finders, storage from django.core.exceptions import ImproperlyConfigured from django.test import SimpleTestCase, override_settings from .cases import StaticFilesTestCase from .settings import TEST_ROOT class TestFinders: """ B...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/staticfiles_tests/cases.py
tests/staticfiles_tests/cases.py
import os import shutil import tempfile from django.conf import settings from django.core.management import call_command from django.template import Context, Template from django.test import SimpleTestCase, override_settings from .settings import TEST_SETTINGS class BaseStaticFilesMixin: """ Test case with ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/staticfiles_tests/storage.py
tests/staticfiles_tests/storage.py
import os from datetime import UTC, datetime, timedelta from django.conf import settings from django.contrib.staticfiles.storage import ManifestStaticFilesStorage from django.core.files import storage class DummyStorage(storage.Storage): """ A storage class that implements get_modified_time() but raises ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/staticfiles_tests/test_forms.py
tests/staticfiles_tests/test_forms.py
from urllib.parse import urljoin from django.conf import STATICFILES_STORAGE_ALIAS from django.contrib.staticfiles import storage from django.forms import Media from django.templatetags.static import static from django.test import SimpleTestCase, override_settings class StaticTestStorage(storage.StaticFilesStorage):...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/staticfiles_tests/test_utils.py
tests/staticfiles_tests/test_utils.py
from django.contrib.staticfiles.utils import check_settings from django.core.exceptions import ImproperlyConfigured from django.test import SimpleTestCase, override_settings class CheckSettingsTests(SimpleTestCase): @override_settings(DEBUG=True, MEDIA_URL="static/media/", STATIC_URL="static/") def test_media...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/staticfiles_tests/test_views.py
tests/staticfiles_tests/test_views.py
import posixpath from urllib.parse import quote from django.conf import settings from django.test import override_settings from .cases import StaticFilesTestCase, TestDefaults @override_settings(ROOT_URLCONF="staticfiles_tests.urls.default") class TestServeStatic(StaticFilesTestCase): """ Test static asset ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/staticfiles_tests/test_templatetags.py
tests/staticfiles_tests/test_templatetags.py
from django.conf import STATICFILES_STORAGE_ALIAS from django.test import override_settings from .cases import StaticFilesTestCase class TestTemplateTag(StaticFilesTestCase): def test_template_tag(self): self.assertStaticRenders("does/not/exist.png", "/static/does/not/exist.png") self.assertStati...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/staticfiles_tests/test_management.py
tests/staticfiles_tests/test_management.py
import datetime import os import shutil import tempfile import unittest from io import StringIO from pathlib import Path from unittest import mock from admin_scripts.tests import AdminScriptTestCase from django.conf import STATICFILES_STORAGE_ALIAS, settings from django.contrib.staticfiles import storage from django....
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/staticfiles_tests/settings.py
tests/staticfiles_tests/settings.py
import os.path from pathlib import Path TEST_ROOT = os.path.dirname(__file__) TEST_SETTINGS = { "MEDIA_URL": "media/", "STATIC_URL": "static/", "MEDIA_ROOT": os.path.join(TEST_ROOT, "project", "site_media", "media"), "STATIC_ROOT": os.path.join(TEST_ROOT, "project", "site_media", "static"), "STATI...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/staticfiles_tests/test_liveserver.py
tests/staticfiles_tests/test_liveserver.py
""" A subset of the tests in tests/servers/tests exercising django.contrib.staticfiles.testing.StaticLiveServerTestCase instead of django.test.LiveServerTestCase. """ import os from urllib.request import urlopen from django.contrib.staticfiles.testing import StaticLiveServerTestCase from django.core.exceptions import...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/staticfiles_tests/__init__.py
tests/staticfiles_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/staticfiles_tests/test_storage.py
tests/staticfiles_tests/test_storage.py
import json import os import shutil import sys import tempfile import unittest from io import StringIO from pathlib import Path from unittest import mock from django.conf import STATICFILES_STORAGE_ALIAS, settings from django.contrib.staticfiles import finders, storage from django.contrib.staticfiles.management.comman...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
true
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/staticfiles_tests/test_handlers.py
tests/staticfiles_tests/test_handlers.py
from django.contrib.staticfiles.handlers import ASGIStaticFilesHandler from django.core.handlers.asgi import ASGIHandler from django.test import AsyncRequestFactory from .cases import StaticFilesTestCase class MockApplication: """ASGI application that returns a string indicating that it was called.""" async...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/staticfiles_tests/apps/staticfiles_config.py
tests/staticfiles_tests/apps/staticfiles_config.py
from django.contrib.staticfiles.apps import StaticFilesConfig class IgnorePatternsAppConfig(StaticFilesConfig): ignore_patterns = ["*.css", "*/vendor/*.js"]
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/staticfiles_tests/apps/__init__.py
tests/staticfiles_tests/apps/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/staticfiles_tests/apps/test/__init__.py
tests/staticfiles_tests/apps/test/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/staticfiles_tests/apps/no_label/__init__.py
tests/staticfiles_tests/apps/no_label/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/staticfiles_tests/urls/helper.py
tests/staticfiles_tests/urls/helper.py
from django.contrib.staticfiles.urls import staticfiles_urlpatterns urlpatterns = staticfiles_urlpatterns()
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/staticfiles_tests/urls/default.py
tests/staticfiles_tests/urls/default.py
from django.contrib.staticfiles import views from django.urls import re_path urlpatterns = [ re_path("^static/(?P<path>.*)$", views.serve), ]
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/staticfiles_tests/urls/__init__.py
tests/staticfiles_tests/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/xor_lookups/models.py
tests/xor_lookups/models.py
from django.db import models class Number(models.Model): num = models.IntegerField() def __str__(self): return str(self.num)
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/xor_lookups/__init__.py
tests/xor_lookups/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/xor_lookups/tests.py
tests/xor_lookups/tests.py
from django.db.models import Q from django.test import TestCase from .models import Number class XorLookupsTests(TestCase): @classmethod def setUpTestData(cls): cls.numbers = [Number.objects.create(num=i) for i in range(10)] def test_filter(self): self.assertCountEqual( Numbe...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_indexes/models.py
tests/model_indexes/models.py
from django.db import models class Book(models.Model): title = models.CharField(max_length=50) author = models.CharField(max_length=50) pages = models.IntegerField(db_column="page_count") shortcut = models.CharField(max_length=50, db_tablespace="idx_tbls") isbn = models.CharField(max_length=50, db...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_indexes/__init__.py
tests/model_indexes/__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_indexes/tests.py
tests/model_indexes/tests.py
from unittest import mock from django.conf import settings from django.db import connection, models from django.db.models.functions import Lower, Upper from django.test import SimpleTestCase, TestCase, override_settings, skipUnlessDBFeature from django.test.utils import isolate_apps from .models import Book, ChildMod...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/get_or_create/models.py
tests/get_or_create/models.py
from django.db import models class Person(models.Model): first_name = models.CharField(max_length=100, unique=True) last_name = models.CharField(max_length=100) birthday = models.DateField() defaults = models.TextField() create_defaults = models.TextField() class DefaultPerson(models.Model): ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/get_or_create/__init__.py
tests/get_or_create/__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_or_create/tests.py
tests/get_or_create/tests.py
import time import traceback from datetime import date, datetime, timedelta from threading import Event, Thread, Timer from unittest.mock import patch from django.core.exceptions import FieldError from django.db import DatabaseError, IntegrityError, connection from django.test import TestCase, TransactionTestCase, ski...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/sessions_tests/models.py
tests/sessions_tests/models.py
""" This custom Session model adds an extra column to store an account ID. In real-world applications, it gives you the option of querying the database for all active sessions for a particular account. """ from django.contrib.sessions.backends.db import SessionStore as DBStore from django.contrib.sessions.base_session...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/sessions_tests/__init__.py
tests/sessions_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/sessions_tests/no_clear_expired.py
tests/sessions_tests/no_clear_expired.py
from django.contrib.sessions.backends.base import SessionBase class SessionStore(SessionBase): """Session store without support for clearing expired sessions.""" pass
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/sessions_tests/tests.py
tests/sessions_tests/tests.py
import base64 import os import shutil import string import tempfile import unittest from datetime import timedelta from http import cookies from pathlib import Path from unittest import mock from django.conf import settings from django.contrib.sessions.backends.base import SessionBase, UpdateError from django.contrib....
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
true
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_utils/__init__.py
tests/model_utils/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_utils/tests.py
tests/model_utils/tests.py
from django.db.models.utils import create_namedtuple_class from django.test import SimpleTestCase class NamedTupleClassTests(SimpleTestCase): def test_immutability(self): row_class = create_namedtuple_class("field1", "field2") row = row_class("value1", "value2") with self.assertRaises(Attr...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/custom_lookups/models.py
tests/custom_lookups/models.py
from django.db import models class Author(models.Model): name = models.CharField(max_length=20) alias = models.CharField(max_length=20) age = models.IntegerField(null=True) birthdate = models.DateField(null=True) average_rating = models.FloatField(null=True) def __str__(self): return ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/custom_lookups/__init__.py
tests/custom_lookups/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/custom_lookups/tests.py
tests/custom_lookups/tests.py
import time import unittest from datetime import date, datetime from django.core.exceptions import FieldError from django.db import connection, models from django.db.models.fields.related_lookups import RelatedGreaterThan from django.db.models.functions import Lower from django.db.models.lookups import EndsWith, Start...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/distinct_on_fields/models.py
tests/distinct_on_fields/models.py
from django.db import models class Tag(models.Model): name = models.CharField(max_length=10) parent = models.ForeignKey( "self", models.SET_NULL, blank=True, null=True, related_name="children", ) class Meta: ordering = ["name"] def __str__(self): ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/distinct_on_fields/__init__.py
tests/distinct_on_fields/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/distinct_on_fields/tests.py
tests/distinct_on_fields/tests.py
from django.db import connection from django.db.models import CharField, F, Max from django.db.models.functions import Lower from django.test import TestCase, skipUnlessDBFeature from django.test.utils import register_lookup from .models import Celebrity, Fan, Staff, StaffTag, Tag @skipUnlessDBFeature("can_distinct_...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/context_processors/views.py
tests/context_processors/views.py
from django.shortcuts import render from .models import DebugObject def request_processor(request): return render(request, "context_processors/request_attrs.html") def debug_processor(request): context = { "debug_objects": DebugObject.objects, "other_debug_objects": DebugObject.objects.usin...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/context_processors/models.py
tests/context_processors/models.py
from django.db import models class DebugObject(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/context_processors/__init__.py
tests/context_processors/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/context_processors/tests.py
tests/context_processors/tests.py
""" Tests for Django's bundled context processors. """ from django.test import SimpleTestCase, TestCase, modify_settings, override_settings from django.utils.csp import CSP @override_settings( ROOT_URLCONF="context_processors.urls", TEMPLATES=[ { "BACKEND": "django.template.backends.djang...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/context_processors/urls.py
tests/context_processors/urls.py
from django.urls import path from . import views urlpatterns = [ path("request_attrs/", views.request_processor), path("debug/", views.debug_processor), path("csp_nonce/", views.csp_nonce_processor), ]
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/delete/models.py
tests/delete/models.py
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import models class P(models.Model): pass class R(models.Model): is_default = models.BooleanField(default=False) p = models.ForeignKey(P, models.CAS...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/delete/__init__.py
tests/delete/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/delete/tests.py
tests/delete/tests.py
from math import ceil from django.db import connection, models from django.db.models import ProtectedError, Q, RestrictedError from django.db.models.deletion import Collector from django.db.models.sql.constants import GET_ITERATOR_CHUNK_SIZE from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature from ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
true
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/test_model_checks.py
tests/check_framework/test_model_checks.py
from django.core import checks from django.core.checks import Error, Warning from django.db import models from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature from django.test.utils import ( isolate_apps, modify_settings, override_settings, override_system_checks, ) class EmptyRouter:...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/test_async_checks.py
tests/check_framework/test_async_checks.py
import os from unittest import mock from django.core.checks.async_checks import E001, check_async_unsafe from django.test import SimpleTestCase class AsyncCheckTests(SimpleTestCase): @mock.patch.dict(os.environ, {"DJANGO_ALLOW_ASYNC_UNSAFE": ""}) def test_no_allowed_async_unsafe(self): self.assertEqu...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/test_files.py
tests/check_framework/test_files.py
from pathlib import Path from django.core.checks import Error from django.core.checks.files import check_setting_file_upload_temp_dir from django.test import SimpleTestCase class FilesCheckTests(SimpleTestCase): def test_file_upload_temp_dir(self): tests = [ None, "", ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/test_model_field_deprecation.py
tests/check_framework/test_model_field_deprecation.py
from django.core import checks from django.db import models from django.test import SimpleTestCase from django.test.utils import isolate_apps @isolate_apps("check_framework") class TestDeprecatedField(SimpleTestCase): def test_default_details(self): class MyField(models.Field): system_check_de...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/models.py
tests/check_framework/models.py
from django.core.checks import register from django.db import models class SimpleModel(models.Model): field = models.IntegerField() manager = models.manager.Manager() @register("tests") def my_check(app_configs, **kwargs): my_check.did_run = True return [] my_check.did_run = False
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/test_multi_db.py
tests/check_framework/test_multi_db.py
from unittest import mock from django.db import connections, models from django.test import SimpleTestCase from django.test.utils import isolate_apps, override_settings class TestRouter: """ Routes to the 'other' database if the model name starts with 'Other'. """ def allow_migrate(self, db, app_lab...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/test_translation.py
tests/check_framework/test_translation.py
from django.core.checks import Error from django.core.checks.translation import ( check_language_settings_consistent, check_setting_language_code, check_setting_languages, check_setting_languages_bidi, ) from django.test import SimpleTestCase, override_settings class TranslationCheckTests(SimpleTestCa...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/test_database.py
tests/check_framework/test_database.py
import unittest from unittest import mock from django.core.checks.database import check_database_backends from django.db import connection, connections from django.test import TestCase class DatabaseCheckTests(TestCase): databases = {"default", "other"} @mock.patch("django.db.backends.base.validation.BaseDa...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/test_urls.py
tests/check_framework/test_urls.py
from django.conf import settings from django.core.checks.messages import Error, Warning from django.core.checks.urls import ( E006, check_custom_error_handlers, check_url_config, check_url_namespaces_unique, check_url_settings, get_warning_for_invalid_pattern, ) 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/check_framework/test_4_0_compatibility.py
tests/check_framework/test_4_0_compatibility.py
from django.core.checks import Error from django.core.checks.compatibility.django_4_0 import check_csrf_trusted_origins from django.test import SimpleTestCase from django.test.utils import override_settings class CheckCSRFTrustedOrigins(SimpleTestCase): @override_settings(CSRF_TRUSTED_ORIGINS=["example.com"]) ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/__init__.py
tests/check_framework/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/tests.py
tests/check_framework/tests.py
import multiprocessing import sys from io import StringIO from unittest import mock, skipIf from django.apps import apps from django.core import checks from django.core.checks import Error, Tags, Warning from django.core.checks.messages import CheckMessage from django.core.checks.registry import CheckRegistry from dja...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/test_caches.py
tests/check_framework/test_caches.py
import pathlib from django.core.checks import Warning from django.core.checks.caches import ( E001, check_cache_location_not_exposed, check_default_cache_is_configured, check_file_based_cache_is_absolute, ) from django.test import SimpleTestCase from django.test.utils import override_settings class C...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/test_security.py
tests/check_framework/test_security.py
import itertools from django.conf import settings from django.core.checks.messages import Error, Warning from django.core.checks.security import base, csrf, sessions from django.core.management.utils import get_random_secret_key from django.test import SimpleTestCase from django.test.utils import override_settings fro...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/test_templates.py
tests/check_framework/test_templates.py
from copy import deepcopy from itertools import chain from django.core.checks import Error, Warning from django.core.checks.templates import check_templates from django.template import engines from django.template.backends.base import BaseEngine from django.test import SimpleTestCase from django.test.utils import over...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/test_commands.py
tests/check_framework/test_commands.py
from django.core import checks from django.core.checks import Error from django.test import SimpleTestCase from django.test.utils import isolate_apps, override_settings, override_system_checks @isolate_apps("check_framework.custom_commands_app", attr_name="apps") @override_settings(INSTALLED_APPS=["check_framework.cu...
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/__init__.py
tests/check_framework/template_test_apps/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/check_framework/template_test_apps/different_tags_app/__init__.py
tests/check_framework/template_test_apps/different_tags_app/__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/template_test_apps/different_tags_app/apps.py
tests/check_framework/template_test_apps/different_tags_app/apps.py
from django.apps import AppConfig class DifferentTagsAppAppConfig(AppConfig): name = "check_framework.template_test_apps.different_tags_app"
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/different_tags_app/templatetags/__init__.py
tests/check_framework/template_test_apps/different_tags_app/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/template_test_apps/different_tags_app/templatetags/different_tags.py
tests/check_framework/template_test_apps/different_tags_app/templatetags/different_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_2/__init__.py
tests/check_framework/template_test_apps/same_tags_app_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/check_framework/template_test_apps/same_tags_app_2/apps.py
tests/check_framework/template_test_apps/same_tags_app_2/apps.py
from django.apps import AppConfig class SameTagsApp2AppConfig(AppConfig): name = "check_framework.template_test_apps.same_tags_app_2"
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_2/templatetags/same_tags.py
tests/check_framework/template_test_apps/same_tags_app_2/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_2/templatetags/__init__.py
tests/check_framework/template_test_apps/same_tags_app_2/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/template_test_apps/same_tags_app_1/__init__.py
tests/check_framework/template_test_apps/same_tags_app_1/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false