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/migrations/test_migrations_squashed_extra/__init__.py
tests/migrations/test_migrations_squashed_extra/__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_apps/__init__.py
tests/test_runner_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/test_runner_apps/failures/__init__.py
tests/test_runner_apps/failures/__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_apps/failures/tests_failures.py
tests/test_runner_apps/failures/tests_failures.py
from unittest import TestCase, expectedFailure class FailureTestCase(TestCase): def test_sample(self): self.assertEqual(0, 1) class ErrorTestCase(TestCase): def test_sample(self): raise Exception("test") class ExpectedFailureTestCase(TestCase): @expectedFailure def test_sample(self...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/test_runner_apps/databases/__init__.py
tests/test_runner_apps/databases/__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_apps/databases/tests.py
tests/test_runner_apps/databases/tests.py
import unittest class NoDatabaseTests(unittest.TestCase): def test_nothing(self): pass class DefaultDatabaseTests(NoDatabaseTests): databases = {"default"} class DefaultDatabaseSerializedTests(NoDatabaseTests): databases = {"default"} serialized_rollback = True class OtherDatabaseTests(N...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/test_runner_apps/simple/__init__.py
tests/test_runner_apps/simple/__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_apps/simple/tests.py
tests/test_runner_apps/simple/tests.py
from unittest import TestCase from django.test import SimpleTestCase from django.test import TestCase as DjangoTestCase class DjangoCase1(DjangoTestCase): def test_1(self): pass def test_2(self): pass class DjangoCase2(DjangoTestCase): def test_1(self): pass def test_2(sel...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/test_runner_apps/tagged/tests_inheritance.py
tests/test_runner_apps/tagged/tests_inheritance.py
from unittest import TestCase from django.test import tag @tag("foo") class FooBase(TestCase): pass class Foo(FooBase): def test_no_new_tags(self): pass @tag("baz") def test_new_func_tag(self): pass @tag("bar") class FooBar(FooBase): def test_new_class_tag_only(self): ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/test_runner_apps/tagged/tests_syntax_error.py
tests/test_runner_apps/tagged/tests_syntax_error.py
from unittest import TestCase from django.test import tag @tag('syntax_error') class SyntaxErrorTestCase(TestCase): pass 1syntax_error # NOQA
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/test_runner_apps/tagged/__init__.py
tests/test_runner_apps/tagged/__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_apps/tagged/tests.py
tests/test_runner_apps/tagged/tests.py
from unittest import TestCase from django.test import tag @tag("slow") class TaggedTestCase(TestCase): @tag("fast") def test_single_tag(self): self.assertEqual(1, 1) @tag("fast", "core") def test_multiple_tags(self): self.assertEqual(1, 1)
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/test_runner_apps/sample/doctests.py
tests/test_runner_apps/sample/doctests.py
""" Doctest example from the official Python documentation. https://docs.python.org/library/doctest.html """ def factorial(n): """Return the factorial of n, an exact integer >= 0. >>> [factorial(n) for n in range(6)] [1, 1, 2, 6, 24, 120] >>> factorial(30) # doctest: +ELLIPSIS 265252859812191058...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/test_runner_apps/sample/tests_sample.py
tests/test_runner_apps/sample/tests_sample.py
import doctest from unittest import TestCase from django.test import SimpleTestCase from django.test import TestCase as DjangoTestCase from . import doctests class TestVanillaUnittest(TestCase): def test_sample(self): self.assertEqual(1, 1) class TestDjangoTestCase(DjangoTestCase): def test_sample...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/test_runner_apps/sample/__init__.py
tests/test_runner_apps/sample/__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_apps/sample/empty.py
tests/test_runner_apps/sample/empty.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_apps/sample/pattern_tests.py
tests/test_runner_apps/sample/pattern_tests.py
from unittest import TestCase class Test(TestCase): def test_sample(self): self.assertEqual(1, 1)
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/test_runner_apps/sample/tests/__init__.py
tests/test_runner_apps/sample/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/test_runner_apps/sample/tests/tests.py
tests/test_runner_apps/sample/tests/tests.py
from unittest import TestCase class Test(TestCase): def test_sample(self): pass
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/test_runner_apps/buffer/tests_buffer.py
tests/test_runner_apps/buffer/tests_buffer.py
import sys from unittest import TestCase class WriteToStdoutStderrTestCase(TestCase): def test_pass(self): sys.stderr.write("Write to stderr.") sys.stdout.write("Write to stdout.") self.assertTrue(True) def test_fail(self): sys.stderr.write("Write to stderr.") sys.stdo...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/null_fk_ordering/models.py
tests/null_fk_ordering/models.py
""" Regression tests for proper working of ForeignKey(null=True). Tests these bugs: * #7512: including a nullable foreign key reference in Meta ordering has unexpected results """ from django.db import models # The first two models represent a very simple null FK ordering case. class Author(models.Model): ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/null_fk_ordering/__init__.py
tests/null_fk_ordering/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/null_fk_ordering/tests.py
tests/null_fk_ordering/tests.py
from django.test import TestCase from .models import Article, Author, Comment, Forum, Post, SystemInfo class NullFkOrderingTests(TestCase): def test_ordering_across_null_fk(self): """ Regression test for #7512 ordering across nullable Foreign Keys shouldn't exclude results """ ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/aggregation/models.py
tests/aggregation/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) rating = models.FloatField(null=True) def __str__(self): return self.name class Publisher(models.Model): ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/aggregation/__init__.py
tests/aggregation/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/aggregation/test_filter_argument.py
tests/aggregation/test_filter_argument.py
import datetime from decimal import Decimal from django.db.models import ( Avg, Case, Count, Exists, F, Max, OuterRef, Q, StdDev, Subquery, Sum, Variance, When, ) from django.test import TestCase from django.test.utils import Approximate from .models import Author, ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/aggregation/tests.py
tests/aggregation/tests.py
import datetime import math import re from decimal import Decimal from django.core.exceptions import FieldError from django.db import NotSupportedError, connection from django.db.models import ( AnyValue, Avg, Case, CharField, Count, DateField, DateTimeField, DecimalField, DurationF...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
true
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/queries/test_sqlcompiler.py
tests/queries/test_sqlcompiler.py
from django.db import DEFAULT_DB_ALIAS, connection from django.db.models.sql import Query from django.test import SimpleTestCase from .models import Item class SQLCompilerTest(SimpleTestCase): def test_repr(self): query = Query(Item) compiler = query.get_compiler(DEFAULT_DB_ALIAS, connection) ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/queries/test_q.py
tests/queries/test_q.py
from datetime import datetime from django.core.exceptions import FieldError from django.db import connection from django.db.models import ( BooleanField, Exists, ExpressionWrapper, F, OuterRef, Q, Value, ) from django.db.models.expressions import NegatedExpression, RawSQL from django.db.mod...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/queries/test_query.py
tests/queries/test_query.py
from datetime import datetime from django.core.exceptions import FieldError from django.db import DEFAULT_DB_ALIAS, connection from django.db.models import BooleanField, CharField, F, Q from django.db.models.expressions import ( Col, Exists, ExpressionWrapper, Func, RawSQL, Value, ) from django...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/queries/models.py
tests/queries/models.py
""" Various complex queries that have been problematic in the past. """ import datetime from django.db import models from django.db.models.functions import Now class DumbCategory(models.Model): pass class ProxyCategory(DumbCategory): class Meta: proxy = True class NamedCategory(DumbCategory): ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/queries/test_iterator.py
tests/queries/test_iterator.py
import datetime from unittest import mock from django.db import connections from django.db.models.sql.compiler import cursor_iter from django.test import TestCase from .models import Article class QuerySetIteratorTests(TestCase): itersize_index_in_mock_args = 3 @classmethod def setUpTestData(cls): ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/queries/test_qs_combinators.py
tests/queries/test_qs_combinators.py
import operator from datetime import datetime from django.db import DatabaseError, NotSupportedError, connection from django.db.models import ( DateTimeField, Exists, F, IntegerField, OuterRef, Subquery, Transform, Value, ) from django.db.models.functions import Cast, Mod 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/queries/test_db_returning.py
tests/queries/test_db_returning.py
import datetime from django.db import connection from django.test import TestCase, skipUnlessDBFeature from django.test.utils import CaptureQueriesContext from .models import DumbCategory, NonIntegerPKReturningModel, ReturningModel @skipUnlessDBFeature("can_return_columns_from_insert") class ReturningValuesTests(Te...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/queries/test_explain.py
tests/queries/test_explain.py
import json import unittest import xml.etree.ElementTree from django.db import NotSupportedError, connection, transaction from django.db.models import Count from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature from django.test.utils import CaptureQueriesContext from .models import Tag @skipUnlessD...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/queries/__init__.py
tests/queries/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/queries/tests.py
tests/queries/tests.py
import datetime import pickle import sys import unittest from operator import attrgetter from django.core.exceptions import EmptyResultSet, FieldError, FullResultSet from django.db import DEFAULT_DB_ALIAS, connection from django.db.models import CharField, Count, Exists, F, Max, OuterRef, Q from django.db.models.expre...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
true
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/queries/test_bulk_update.py
tests/queries/test_bulk_update.py
import datetime from math import ceil from django.core.exceptions import FieldDoesNotExist from django.db import connection from django.db.models import F, IntegerField, Value from django.db.models.functions import Coalesce, Lower from django.db.utils import IntegrityError from django.test import TestCase, override_se...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/queries/test_contains.py
tests/queries/test_contains.py
from django.test import TestCase from .models import DumbCategory, NamedCategory, ProxyCategory class ContainsTests(TestCase): @classmethod def setUpTestData(cls): cls.category = DumbCategory.objects.create() cls.proxy_category = ProxyCategory.objects.create() def test_unsaved_obj(self):...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/wsgi/__init__.py
tests/wsgi/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/wsgi/tests.py
tests/wsgi/tests.py
from django.core.exceptions import ImproperlyConfigured from django.core.servers.basehttp import get_internal_wsgi_application from django.core.signals import request_started from django.core.wsgi import get_wsgi_application from django.db import close_old_connections from django.http import FileResponse 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/wsgi/wsgi.py
tests/wsgi/wsgi.py
# This is just to test finding, it doesn't have to be a real WSGI callable application = object()
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/wsgi/urls.py
tests/wsgi/urls.py
from django.http import FileResponse, HttpResponse from django.urls import path def helloworld(request): return HttpResponse("Hello World!") def cookie(request): response = HttpResponse("Hello World!") response.set_cookie("key", "value") return response urlpatterns = [ path("", helloworld), ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/datatypes/models.py
tests/datatypes/models.py
""" This is a basic model to test saving and loading boolean and date-related types, which in the past were problematic for some database backends. """ from django.db import models class Donut(models.Model): name = models.CharField(max_length=100) is_frosted = models.BooleanField(default=False) has_sprin...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/datatypes/__init__.py
tests/datatypes/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/datatypes/tests.py
tests/datatypes/tests.py
import datetime from django.test import TestCase, skipIfDBFeature from .models import Donut, RumBaba class DataTypesTestCase(TestCase): def test_boolean_type(self): d = Donut(name="Apple Fritter") self.assertFalse(d.is_frosted) self.assertIsNone(d.has_sprinkles) d.has_sprinkles =...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/dates/models.py
tests/dates/models.py
from django.db import models from django.utils import timezone class Article(models.Model): title = models.CharField(max_length=100) pub_date = models.DateField() pub_datetime = models.DateTimeField(default=timezone.now) categories = models.ManyToManyField("Category", related_name="articles") class...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/dates/__init__.py
tests/dates/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/dates/tests.py
tests/dates/tests.py
import datetime from unittest import skipUnless from django.core.exceptions import FieldError from django.db import connection from django.test import TestCase, override_settings from .models import Article, Category, Comment class DatesTests(TestCase): def test_related_model_traverse(self): a1 = Articl...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/dispatch/__init__.py
tests/dispatch/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/dispatch/tests.py
tests/dispatch/tests.py
import weakref from types import TracebackType from unittest import mock from django.dispatch import Signal, receiver from django.dispatch.dispatcher import _make_id from django.test import SimpleTestCase from django.test.utils import garbage_collect, override_settings def receiver_1_arg(val, **kwargs): return v...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/timezones/admin.py
tests/timezones/admin.py
from django.contrib import admin from .models import Event, Timestamp class EventAdmin(admin.ModelAdmin): list_display = ("dt",) class TimestampAdmin(admin.ModelAdmin): readonly_fields = ("created", "updated") site = admin.AdminSite(name="admin_tz") site.register(Event, EventAdmin) site.register(Timestam...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/timezones/models.py
tests/timezones/models.py
from django.db import models class Event(models.Model): dt = models.DateTimeField() class MaybeEvent(models.Model): dt = models.DateTimeField(blank=True, null=True) class Session(models.Model): name = models.CharField(max_length=20) class SessionEvent(models.Model): dt = models.DateTimeField() ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/timezones/__init__.py
tests/timezones/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/timezones/tests.py
tests/timezones/tests.py
import datetime import re import sys import zoneinfo from contextlib import contextmanager from unittest import SkipTest, skipIf from xml.dom.minidom import parseString from django.contrib.auth.models import User from django.core import serializers from django.db import connection from django.db.models import F, Max, ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
true
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/timezones/forms.py
tests/timezones/forms.py
from django import forms from .models import Event class EventForm(forms.Form): dt = forms.DateTimeField() class EventSplitForm(forms.Form): dt = forms.SplitDateTimeField() class EventLocalizedForm(forms.Form): dt = forms.DateTimeField(localize=True) class EventModelForm(forms.ModelForm): class...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/timezones/urls.py
tests/timezones/urls.py
from django.urls import path from . import admin as tz_admin # NOQA: register tz_admin urlpatterns = [ path("admin/", tz_admin.site.urls), ]
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/generic_relations/test_forms.py
tests/generic_relations/test_forms.py
from django import forms from django.contrib.contenttypes.forms import generic_inlineformset_factory from django.contrib.contenttypes.models import ContentType from django.db import models from django.test import TestCase from django.test.utils import isolate_apps from .models import ( Animal, ForProxyModelMod...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/generic_relations/models.py
tests/generic_relations/models.py
""" Generic relations Generic relations let an object have a foreign key to any object through a content-type/object-id field. A ``GenericForeignKey`` field can point to any object, be it animal, vegetable, or mineral. The canonical example is tags (although this example implementation is *far* from complete). """ f...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/generic_relations/__init__.py
tests/generic_relations/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/generic_relations/tests.py
tests/generic_relations/tests.py
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.prefetch import GenericPrefetch from django.core.exceptions import FieldError, FieldFetchBlocked from django.db.models import Q, prefetch_related_objects from django.db.models.fetch_modes import FETCH_PEERS, RAISE from django.te...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
true
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/foreign_object/test_tuple_lookups.py
tests/foreign_object/test_tuple_lookups.py
import itertools from django.db.models import F from django.db.models.fields.tuple_lookups import ( TupleExact, TupleGreaterThan, TupleGreaterThanOrEqual, TupleIn, TupleIsNull, TupleLessThan, TupleLessThanOrEqual, ) from django.db.models.lookups import In from django.test import TestCase, s...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/foreign_object/test_forms.py
tests/foreign_object/test_forms.py
import datetime from django import forms from django.test import TestCase from .models import Article class FormsTests(TestCase): # ForeignObjects should not have any form fields, currently the user needs # to manually deal with the foreignobject relation. class ArticleForm(forms.ModelForm): cla...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/foreign_object/test_agnostic_order_trimjoin.py
tests/foreign_object/test_agnostic_order_trimjoin.py
from operator import attrgetter from django.test.testcases import TestCase from .models import Address, Contact, Customer class TestLookupQuery(TestCase): @classmethod def setUpTestData(cls): cls.address = Address.objects.create(company=1, customer_id=20) cls.customer1 = Customer.objects.cre...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/foreign_object/__init__.py
tests/foreign_object/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/foreign_object/tests.py
tests/foreign_object/tests.py
import copy import datetime import pickle from operator import attrgetter from django.core.exceptions import FieldError, ValidationError from django.db import connection, models from django.db.models import FETCH_PEERS from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature from django.test.utils import ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/foreign_object/test_empty_join.py
tests/foreign_object/test_empty_join.py
from django.test import TestCase from .models import SlugPage class RestrictedConditionsTests(TestCase): @classmethod def setUpTestData(cls): slugs = [ "a", "a/a", "a/b", "a/b/a", "x", "x/y/z", ] SlugPage.objects....
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/foreign_object/models/article.py
tests/foreign_object/models/article.py
from django.db import models from django.db.models.fields.related import ForwardManyToOneDescriptor from django.utils.translation import get_language class ArticleTranslationDescriptor(ForwardManyToOneDescriptor): """ The set of articletranslation should not set any local fields. """ def __set__(self...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/foreign_object/models/empty_join.py
tests/foreign_object/models/empty_join.py
from django.db import models from django.db.models.fields.related import ReverseManyToOneDescriptor from django.db.models.lookups import StartsWith from django.db.models.query_utils import PathInfo class CustomForeignObjectRel(models.ForeignObjectRel): """ Define some extra Field methods so this Rel acts more...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/foreign_object/models/customers.py
tests/foreign_object/models/customers.py
from django.db import models class Address(models.Model): company = models.CharField(max_length=1) customer_id = models.IntegerField() class Meta: unique_together = [ ("company", "customer_id"), ] class Customer(models.Model): company = models.CharField(max_length=1) ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/foreign_object/models/__init__.py
tests/foreign_object/models/__init__.py
from .article import Article, ArticleIdea, ArticleTag, ArticleTranslation, NewsArticle from .customers import Address, Contact, Customer, CustomerTab from .empty_join import SlugPage from .person import Country, Friendship, Group, Membership, Person __all__ = [ "Address", "Article", "ArticleIdea", "Art...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/foreign_object/models/person.py
tests/foreign_object/models/person.py
import datetime from django.db import models class Country(models.Model): # Table Column Fields name = models.CharField(max_length=50) def __str__(self): return self.name class Person(models.Model): # Table Column Fields name = models.CharField(max_length=128) person_country_id = m...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/constraints/models.py
tests/constraints/models.py
from django.db import models from django.db.models.functions import Coalesce, Lower class Product(models.Model): price = models.IntegerField(null=True) discounted_price = models.IntegerField(null=True) unit = models.CharField(max_length=15, null=True) class Meta: required_db_features = { ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/constraints/__init__.py
tests/constraints/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/constraints/tests.py
tests/constraints/tests.py
from datetime import datetime, timedelta from unittest import mock from django.core.exceptions import ValidationError from django.db import IntegrityError, connection, models from django.db.models import Case, F, When from django.db.models.constraints import BaseConstraint, UniqueConstraint from django.db.models.funct...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
true
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/aggregation_regress/models.py
tests/aggregation_regress/models.py
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import models class Author(models.Model): name = models.CharField(max_length=100) age = models.IntegerField() friends = models.ManyToManyField("self",...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/aggregation_regress/__init__.py
tests/aggregation_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/aggregation_regress/tests.py
tests/aggregation_regress/tests.py
import datetime import pickle from decimal import Decimal from operator import attrgetter from unittest import mock from django.contrib.contenttypes.models import ContentType from django.core.exceptions import FieldError from django.db import connection from django.db.models import ( Aggregate, Avg, Case, ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
true
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/many_to_one/models.py
tests/many_to_one/models.py
""" Many-to-one relationships To define a many-to-one relationship, use ``ForeignKey()``. """ from django.db import models class Reporter(models.Model): first_name = models.CharField(max_length=30) last_name = models.CharField(max_length=30) email = models.EmailField() def __str__(self): re...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/many_to_one/__init__.py
tests/many_to_one/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/many_to_one/tests.py
tests/many_to_one/tests.py
import datetime from copy import deepcopy from django.core.exceptions import ( FieldError, FieldFetchBlocked, MultipleObjectsReturned, ) from django.db import IntegrityError, models, transaction from django.db.models import FETCH_PEERS, RAISE from django.test import TestCase from django.utils.translation i...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
true
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/test_exceptions/__init__.py
tests/test_exceptions/__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_exceptions/test_validation_error.py
tests/test_exceptions/test_validation_error.py
import unittest from unittest import mock from django.core.exceptions import ValidationError class TestValidationError(unittest.TestCase): def test_messages_concatenates_error_dict_values(self): message_dict = {} exception = ValidationError(message_dict) self.assertEqual(sorted(exception....
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/migrate_signals/models.py
tests/migrate_signals/models.py
# This module has to exist, otherwise pre/post_migrate aren't sent for the # migrate_signals application.
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/migrate_signals/__init__.py
tests/migrate_signals/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/migrate_signals/tests.py
tests/migrate_signals/tests.py
from io import StringIO from django.apps import apps from django.core import management from django.db import migrations from django.db.models import signals from django.test import TransactionTestCase, override_settings APP_CONFIG = apps.get_app_config("migrate_signals") SIGNAL_ARGS = [ "app_config", "verbos...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/migrate_signals/custom_migrations/0001_initial.py
tests/migrate_signals/custom_migrations/0001_initial.py
from django.db import migrations, models class Migration(migrations.Migration): operations = [ migrations.CreateModel( "Signal", [ ("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/migrate_signals/custom_migrations/__init__.py
tests/migrate_signals/custom_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/swappable_models/models.py
tests/swappable_models/models.py
from django.db import models class Article(models.Model): title = models.CharField(max_length=100) publication_date = models.DateField() class Meta: swappable = "TEST_ARTICLE_MODEL" class AlternateArticle(models.Model): title = models.CharField(max_length=100) publication_date = models....
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/swappable_models/__init__.py
tests/swappable_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/swappable_models/tests.py
tests/swappable_models/tests.py
from django.contrib.auth.models import Permission from django.contrib.contenttypes.models import ContentType from django.core import management from django.test import TestCase, override_settings from .models import Article class SwappableModelTests(TestCase): # Limit memory usage when calling 'migrate'. ava...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/str/models.py
tests/str/models.py
""" Adding __str__() to models Although it's not a strict requirement, each model should have a ``_str__()`` method to return a "human-readable" representation of the object. Do this not only for your own sanity when dealing with the interactive prompt, but also because objects' representations are used throughout Dja...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/str/__init__.py
tests/str/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/str/tests.py
tests/str/tests.py
import datetime from django.db import models from django.test import TestCase from django.test.utils import isolate_apps from .models import InternationalArticle class SimpleTests(TestCase): def test_international(self): a = InternationalArticle.objects.create( headline="Girl wins €12.500 in...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/raw_query/models.py
tests/raw_query/models.py
from django.db import models class Author(models.Model): first_name = models.CharField(max_length=255) last_name = models.CharField(max_length=255) dob = models.DateField() def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # Protect against annotations being passe...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/raw_query/__init__.py
tests/raw_query/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/raw_query/tests.py
tests/raw_query/tests.py
from datetime import date from decimal import Decimal from django.core.exceptions import FieldDoesNotExist, FieldFetchBlocked from django.db.models import FETCH_PEERS, RAISE from django.db.models.query import RawQuerySet from django.test import TestCase, skipUnlessDBFeature from .models import ( Author, Book,...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/m2m_signals/models.py
tests/m2m_signals/models.py
from django.db import models class Part(models.Model): name = models.CharField(max_length=20) class Meta: ordering = ("name",) class Car(models.Model): name = models.CharField(max_length=20) default_parts = models.ManyToManyField(Part) optional_parts = models.ManyToManyField(Part, relat...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/m2m_signals/__init__.py
tests/m2m_signals/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/m2m_signals/tests.py
tests/m2m_signals/tests.py
""" Testing signals emitted on changing m2m relations. """ from django.db import models from django.test import TestCase from .models import Car, Part, Person, SportsCar class ManyToManySignalsTest(TestCase): @classmethod def setUpTestData(cls): cls.vw = Car.objects.create(name="VW") cls.bmw...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false