hash stringlengths 64 64 | content stringlengths 0 1.51M |
|---|---|
c43ae25d1bb3ac6e960eaa43f31fd5e7649ae64675a3c18f5dab7e73e6a4d771 | import datetime
from django.core.exceptions import ValidationError
from django.forms import DurationField
from django.test import SimpleTestCase
from django.utils import translation
from django.utils.duration import duration_string
from . import FormFieldAssertionsMixin
class DurationFieldTest(FormFieldAssertionsMi... |
313da6aeca2bc388b6d8ea8c1b2cf52f1ef2c76f694631fc6c8b39ee919f7038 | import uuid
from django.forms import UUIDField, ValidationError
from django.test import SimpleTestCase
class UUIDFieldTest(SimpleTestCase):
def test_uuidfield_1(self):
field = UUIDField()
value = field.clean('550e8400e29b41d4a716446655440000')
self.assertEqual(value, uuid.UUID('550e8400e... |
7c69be2262de9f85cbd1afe141d6b12220fdc90b654cbb3a98113d09fe438c03 | import datetime
from collections import Counter
from unittest import mock
from django.forms import (
BaseForm, CharField, DateField, FileField, Form, IntegerField,
SplitDateTimeField, ValidationError, formsets,
)
from django.forms.formsets import BaseFormSet, all_valid, formset_factory
from django.forms.utils ... |
d87423cbd8e18911287e603878444a1b9dcfdae8517c19efc53dada22ad00b93 | import copy
from django.core.exceptions import ValidationError
from django.forms.utils import ErrorDict, ErrorList, flatatt
from django.test import SimpleTestCase
from django.utils.safestring import mark_safe
from django.utils.translation import gettext_lazy
class FormsUtilsTestCase(SimpleTestCase):
# Tests for ... |
8a9206f535f3198b6aa9065b8b9106f51d78ccb8989f5dd036ff52512d2db49d | from django.contrib.admin.tests import AdminSeleniumTestCase
from django.test import override_settings
from django.urls import reverse
from ..models import Article
@override_settings(ROOT_URLCONF='forms_tests.urls')
class LiveWidgetTests(AdminSeleniumTestCase):
available_apps = ['forms_tests'] + AdminSeleniumTe... |
96ee814d2ad971655f4338ac6c958ce6adbf0a256bbb31efd222206405ecbb7e | from django.forms import CharField, Form, Media, MultiWidget, TextInput
from django.template import Context, Template
from django.test import SimpleTestCase, override_settings
@override_settings(
STATIC_URL='http://media.example.com/static/',
)
class FormsMediaTestCase(SimpleTestCase):
"""Tests for the media ... |
cb49e00554fff9491f1f78eca5bd87265b3b30d179518a679cbd229757d8fc75 | import copy
import datetime
import json
import uuid
from django.core.exceptions import NON_FIELD_ERRORS
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.validators import MaxValueValidator, RegexValidator
from django.forms import (
BooleanField, CharField, CheckboxSelectMultiple, Choi... |
70c9da618460d968cff06847222372b3f66d3422aeb9b901ba1da7a20433d381 | import mimetypes
import unittest
from os import path
from urllib.parse import quote
from django.conf.urls.static import static
from django.core.exceptions import ImproperlyConfigured
from django.http import FileResponse, HttpResponseNotModified
from django.test import SimpleTestCase, override_settings
from django.util... |
24124a84eb78ec0442cf5193ae43b47bcd355d6b89af0b1dbe9353d74efcc5e4 | import datetime
from django.contrib.sites.models import Site
from django.http import Http404
from django.template import TemplateDoesNotExist
from django.test import RequestFactory, TestCase
from django.test.utils import override_settings
from django.views.defaults import (
bad_request, page_not_found, permission_... |
5bf7907dba061b57209e3e5dd6b5d05afabae17b38d0aafd62c9deb594c74b64 | from django.template import TemplateDoesNotExist
from django.test import (
Client, RequestFactory, SimpleTestCase, override_settings,
)
from django.utils.translation import override
from django.views.csrf import CSRF_FAILURE_TEMPLATE_NAME, csrf_failure
@override_settings(ROOT_URLCONF='view_tests.urls')
class Csrf... |
ca116b6e02852047b91eedbdeacae13bfc622ac04686e3a1fc3379ddfc222c8a | import gettext
import json
from os import path
from django.conf import settings
from django.test import (
RequestFactory, SimpleTestCase, TestCase, ignore_warnings, modify_settings,
override_settings,
)
from django.test.selenium import SeleniumTestCase
from django.urls import reverse
from django.utils.deprecat... |
46b89f5ed00f7640604d0bf1e153f703dcc56cedc2054160d2f7f48b77e20afd | import importlib
import inspect
import os
import re
import sys
import tempfile
import threading
from io import StringIO
from pathlib import Path
from unittest import mock
from django.core import mail
from django.core.files.uploadedfile import SimpleUploadedFile
from django.db import DatabaseError, connection
from djan... |
dabf3c94138db118c025d32770051cf6f95ab8ec1dd125c21cd4c8dd9140e391 | """Models for test_natural.py"""
import uuid
from django.db import models
class NaturalKeyAnchorManager(models.Manager):
def get_by_natural_key(self, data):
return self.get(data=data)
class NaturalKeyAnchor(models.Model):
data = models.CharField(max_length=100, unique=True)
title = models.CharF... |
6d2d5ac6aa08a78b589c373cf5700862ba5d5b197dbcfdc05a170f7ba9e3e2f4 | from django.template import TemplateSyntaxError
from django.test import SimpleTestCase
from ..utils import SomeClass, SomeOtherException, UTF8Class, setup
class FilterSyntaxTests(SimpleTestCase):
@setup({'filter-syntax01': '{{ var|upper }}'})
def test_filter_syntax01(self):
"""
Basic filter ... |
918953fd20d9a30fb6773965d0c3da3dd599220006823e0f315030577d86b5b1 | from django.core.cache import cache
from django.template import Context, Engine, TemplateSyntaxError
from django.test import SimpleTestCase, override_settings
from ..utils import setup
class CacheTagTests(SimpleTestCase):
libraries = {
'cache': 'django.templatetags.cache',
'custom': 'template_tes... |
d0962292a23a61c358cebc35e833a644fae6cc634cd1f0e92336a244388a1e23 | from django.template import RequestContext, TemplateSyntaxError
from django.test import RequestFactory, SimpleTestCase, override_settings
from django.urls import NoReverseMatch, resolve
from ..utils import setup
@override_settings(ROOT_URLCONF='template_tests.urls')
class UrlTagTests(SimpleTestCase):
request_fac... |
93cd63174184a937113cc77d186fd35280e01533329b0bf08081aff1e629b1fb | from django.template.defaultfilters import urlizetrunc
from django.test import SimpleTestCase
from django.utils.safestring import mark_safe
from ..utils import setup
class UrlizetruncTests(SimpleTestCase):
@setup({
'urlizetrunc01': '{% autoescape off %}{{ a|urlizetrunc:"8" }} {{ b|urlizetrunc:"8" }}{% e... |
060fccb7271f000ab6c8da21345653e22d109883a615b407b57ce5ba6d41ca98 | from django.template.defaultfilters import addslashes
from django.test import SimpleTestCase
from django.utils.safestring import mark_safe
from ..utils import setup
class AddslashesTests(SimpleTestCase):
@setup({'addslashes01': '{% autoescape off %}{{ a|addslashes }} {{ b|addslashes }}{% endautoescape %}'})
... |
e431ac1042f25e0602a2175c99ceb66acf7e548f8831065aa4a447e9fb083a0c | from django.template.defaultfilters import truncatewords
from django.test import SimpleTestCase
from django.utils.safestring import mark_safe
from ..utils import setup
class TruncatewordsTests(SimpleTestCase):
@setup({
'truncatewords01': '{% autoescape off %}{{ a|truncatewords:"2" }} {{ b|truncatewords:... |
d1c77667b28e745b85750cad12ccce6ca2c6cf229a8b844dc3f8cea109d5ee22 | from django.template.defaultfilters import make_list
from django.test import SimpleTestCase
from django.utils.safestring import mark_safe
from ..utils import setup
class MakeListTests(SimpleTestCase):
"""
The make_list filter can destroy existing escaping, so the results are
escaped.
"""
@setup(... |
e1a437352bc815caf9b60c025def633a8375e4bf85abbcef2a371c0e05769404 | from django.template.defaultfilters import urlize
from django.test import SimpleTestCase
from django.utils.functional import lazy
from django.utils.safestring import mark_safe
from ..utils import setup
class UrlizeTests(SimpleTestCase):
@setup({'urlize01': '{% autoescape off %}{{ a|urlize }} {{ b|urlize }}{% en... |
f3009e3db74f24e4ff4348180ebcdd376321687e895c366e9badfb587316068e | from django.template.defaultfilters import title
from django.test import SimpleTestCase
from ..utils import setup
class TitleTests(SimpleTestCase):
@setup({'title1': '{{ a|title }}'})
def test_title1(self):
output = self.engine.render_to_string('title1', {'a': 'JOE\'S CRAB SHACK'})
self.asse... |
376ef2d214192d6956f9d4c6fff439720cf7015eab1f11cad57e7b0af28a13dd | from django.template.defaultfilters import filesizeformat
from django.test import SimpleTestCase
from django.utils import translation
class FunctionTests(SimpleTestCase):
def test_formats(self):
tests = [
(0, '0\xa0bytes'),
(1, '1\xa0byte'),
(1023, '1023\xa0bytes'),
... |
616a2a75856c408bed7b9711a50f2d7a581a793cb6ccae1060f0d7472b93777d | from django.template.defaultfilters import truncatechars_html
from django.test import SimpleTestCase
class FunctionTests(SimpleTestCase):
def test_truncate_zero(self):
self.assertEqual(truncatechars_html('<p>one <a href="#">two - three <br>four</a> five</p>', 0), '…')
def test_truncate(self):
... |
3ca7bdfa98c57c7dd32947a85ed2dd249fc53b46566327143f3d618109eae5d1 | from django.template.defaultfilters import truncatewords_html
from django.test import SimpleTestCase
class FunctionTests(SimpleTestCase):
def test_truncate_zero(self):
self.assertEqual(truncatewords_html('<p>one <a href="#">two - three <br>four</a> five</p>', 0), '')
def test_truncate(self):
... |
e3e4b7d35b5cb87924ef2aad516e8d565ea6d903f90a94903863cad2da08d80c | from decimal import Decimal
from django.template.defaultfilters import pluralize
from django.test import SimpleTestCase
from ..utils import setup
class PluralizeTests(SimpleTestCase):
def check_values(self, *tests):
for value, expected in tests:
with self.subTest(value=value):
... |
bba982da4ada14dd0c5fc15236e7540df33b637b357252434c0fbbeb87b26272 | from django.template.defaultfilters import yesno
from django.test import SimpleTestCase
from ..utils import setup
class YesNoTests(SimpleTestCase):
@setup({'t': '{{ var|yesno:"yup,nup,mup" }} {{ var|yesno }}'})
def test_true(self):
output = self.engine.render_to_string('t', {'var': True})
sel... |
1c9e6caddef2e230d6634304cf47fc254f2267408da0114f5380db2a85c89aa2 | from django.test import SimpleTestCase
from ..utils import setup
class TruncatecharsTests(SimpleTestCase):
@setup({'truncatechars01': '{{ a|truncatechars:3 }}'})
def test_truncatechars01(self):
output = self.engine.render_to_string('truncatechars01', {'a': 'Testing, testing'})
self.assertEqu... |
89c23aababd90bc705d8a1eaa58e1938152eb1fab5184267e030ca4e32e295c1 | import operator
from django import template
from django.template.defaultfilters import stringfilter
from django.utils.html import escape, format_html
from django.utils.safestring import mark_safe
register = template.Library()
@register.filter
@stringfilter
def trim(value, num):
return value[:num]
@register.fi... |
60aaa93770c42e3cb0570988b3872bde326dd0167101566deb16ae3f04e6043a | import operator
from django.template import Engine, Library
engine = Engine(app_dirs=True)
register = Library()
@register.inclusion_tag('inclusion.html')
def inclusion_no_params():
"""Expected inclusion_no_params __doc__"""
return {"result": "inclusion_no_params - Expected result"}
inclusion_no_params.any... |
cf12ad3f83d13c48a4d574ab84878fbd712b756a89d0dfc6110c588ac2d17d9b | from django.contrib.sitemaps import views
from django.urls import path
from .http import simple_sitemaps
urlpatterns = [
path(
'simple/index.xml', views.index, {'sitemaps': simple_sitemaps},
name='django.contrib.sitemaps.views.index'),
]
|
bd97cff3d3d6fec2d1b9868b78804be258f295648f3484e50705ba16f3b8c645 | from django.contrib.sitemaps import views
from django.urls import path
from .http import SimpleSitemap
class HTTPSSitemap(SimpleSitemap):
protocol = 'https'
secure_sitemaps = {
'simple': HTTPSSitemap,
}
urlpatterns = [
path('secure/index.xml', views.index, {'sitemaps': secure_sitemaps}),
path(
... |
2b7ca1cd998e6abb98a61730f5906c33a90301e0f7a50505564982c5e5237d74 | from datetime import date, datetime
from django.conf.urls.i18n import i18n_patterns
from django.contrib.sitemaps import GenericSitemap, Sitemap, views
from django.http import HttpResponse
from django.urls import path
from django.utils import timezone
from django.views.decorators.cache import cache_page
from ..models ... |
e640f2ead3441eae856d7cea8ac1ee8e1b60945434c381ba06fcebe4ed6c05fa | import unittest
from django.db import connection
from django.db.models.fields import BooleanField, NullBooleanField
from django.db.utils import DatabaseError
from django.test import TransactionTestCase
from ..models import Square
@unittest.skipUnless(connection.vendor == 'oracle', 'Oracle tests')
class Tests(unitte... |
fae79285822384ca56a3852d0cdcbc7770583552bd8c138e13d4090a27cb8f9f | import unittest
from io import StringIO
from unittest import mock
from django.db import connection
from django.db.backends.oracle.creation import DatabaseCreation
from django.db.utils import DatabaseError
from django.test import TestCase
@unittest.skipUnless(connection.vendor == 'oracle', 'Oracle tests')
@mock.patch... |
26ce1ba29b3ec5ffc342e9febd838dd7129a812bcca437fd06a03ea47f8931bb | import re
import threading
import unittest
from sqlite3 import dbapi2
from unittest import mock
from django.core.exceptions import ImproperlyConfigured
from django.db import connection, transaction
from django.db.models import Avg, StdDev, Sum, Variance
from django.db.models.aggregates import Aggregate
from django.db.... |
4479cfb0d39e5e387b9b0f8b1ca9bb96910a31ef28ef2dc2d8f41bd897d7b48a | import unittest
import sqlparse
from django.db import connection
from django.test import TestCase
@unittest.skipUnless(connection.vendor == 'sqlite', 'SQLite tests')
class IntrospectionTests(TestCase):
def test_get_primary_key_column(self):
"""
Get the primary key column regardless of whether or... |
22148383d36b9954ab9458103ed8f16ff8f32d313163b551b036fe4e43cc4d60 | import decimal
from django.db import NotSupportedError, connection
from django.db.backends.base.operations import BaseDatabaseOperations
from django.db.models import DurationField
from django.test import (
SimpleTestCase, TestCase, override_settings, skipIfDBFeature,
)
from django.utils import timezone
class Sim... |
1d62d2843d44e7af49bbe245283c63c8a387423392c9e4d56c266e817b6e38df | from django.db import models
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
from django.test import SimpleTestCase
class SchemaEditorTests(SimpleTestCase):
def test_effective_default_callable(self):
"""SchemaEditor.effective_default() shouldn't call callable defaults."""
clas... |
bfa18b92c0e2b032f33102506d31b5353e841979a1a9cb10d72b9a7e6fa3920a | from django.db import connection
from django.test import SimpleTestCase
class TestDatabaseFeatures(SimpleTestCase):
def test_nonexistent_feature(self):
self.assertFalse(hasattr(connection.features, 'nonexistent'))
|
dcbfa507e3d361698e9a8dfc4841f7fe8eac6aaaeb5ac75d16f4672b58ed8545 | import unittest
from django.db import connection
from django.test import TestCase
@unittest.skipUnless(connection.vendor == 'mysql', 'MySQL tests')
class SchemaEditorTests(TestCase):
def test_quote_value(self):
import MySQLdb
editor = connection.schema_editor()
tested_values = [
... |
9ee97906f0214fdf39fe4499cc6040d5c49323f8e433333dd61ace42124aabb9 | from unittest import mock, skipUnless
from django.db import connection
from django.db.backends.mysql.features import DatabaseFeatures
from django.test import TestCase
@skipUnless(connection.vendor == 'mysql', 'MySQL tests')
class TestFeatures(TestCase):
def test_supports_transactions(self):
"""
... |
7d2477c5cebc5235788094def875b74c818af157bccc331d1de12f43a70314af | import unittest
from io import StringIO
from unittest import mock
from django.db import connection
from django.db.backends.base.creation import BaseDatabaseCreation
from django.db.backends.mysql.creation import DatabaseCreation
from django.db.utils import DatabaseError
from django.test import SimpleTestCase
@unittes... |
c670458b256426d7a945a543beda2f45d7731d14686d6686ba065a1d1cbeec00 | import unittest
from io import StringIO
from unittest import mock
from django.core.exceptions import ImproperlyConfigured
from django.db import DatabaseError, connection, connections
from django.test import TestCase, override_settings
@unittest.skipUnless(connection.vendor == 'postgresql', 'PostgreSQL tests')
class ... |
b329653a5bd5b6d6e521ffe56ca89fa2ccdfccc1345aa927b99a7e4952fe3cb4 | import unittest
from contextlib import contextmanager
from io import StringIO
from unittest import mock
from django.db import connection
from django.db.backends.base.creation import BaseDatabaseCreation
from django.db.utils import DatabaseError
from django.test import SimpleTestCase
try:
import psycopg2 # NOQA
e... |
492c087c7edcabf2ac1b6d8841ab3424b7d26533ae21ea3439a9fe1d2aa7b7c7 | from django.urls import re_path
urlpatterns = [
re_path('^$', lambda x: x, name='name_with:colon'),
]
|
4d03b806eb7f23c899fd09bd54af5ffff6d1e4dc5daf1ea11e36a873fc877bd4 | from django.urls import include, path, re_path
urlpatterns = [
path('', include([
re_path('^include-with-dollar$', include([])),
])),
]
|
8cbe8027edfeeffbb03ca16ddb6ec8fc188cf928f966465d8d883b480842016d | from django.urls import path, re_path
urlpatterns = [
path('/path-starting-with-slash/', lambda x: x),
re_path(r'/url-starting-with-slash/$', lambda x: x),
]
|
28cefc18129b114baa62ae28972ae96c0739036baba1fd0829a428cce98c6aae | from django.urls import include, re_path
urlpatterns = [
re_path('^include-with-dollar$', include([])),
]
|
4f60c25a864ea0e959efbdb109bc2c309b544932471bed1fdd81cea1070b76ec | from django.urls import include, path
common_url_patterns = ([
path('app-ns1/', include([])),
path('app-url/', include([])),
], 'common')
nested_url_patterns = ([
path('common/', include(common_url_patterns, namespace='nested')),
], 'nested')
urlpatterns = [
path('app-ns1-0/', include(common_url_patt... |
cd1c203b45d4d067eec08a2f06de5db55d6aacb22dbd6f1d2775a2262697641a | urlpatterns = []
handler400 = __name__ + '.bad_handler'
handler403 = __name__ + '.bad_handler'
handler404 = __name__ + '.bad_handler'
handler500 = __name__ + '.bad_handler'
def bad_handler():
pass
|
ea15c1b2d90c119b6b29ae99b5ca650d17a6a151a71a36f3b9f808d5ed7a63f8 | urlpatterns = []
handler400 = 'django.views.bad_handler'
handler403 = 'django.invalid_module.bad_handler'
handler404 = 'invalid_module.bad_handler'
handler500 = 'django'
|
0e3ebd796f53ee8b0fd2f10bea07425672c9cdd6759bdfb52eaa9168b65dfb8c | from django.urls import include, path
common_url_patterns = ([
path('app-ns1/', include([])),
path('app-url/', include([])),
], 'app-ns1')
urlpatterns = [
path('app-ns1-0/', include(common_url_patterns)),
path('app-ns1-1/', include(common_url_patterns)),
path('app-some-url/', include(([], 'app'), ... |
eb1c7d16db7429fdf45faf4f73828addb2027eb95b514575949733df4451ac3d | from django.urls import include, path, re_path
urlpatterns = [
path('foo/', lambda x: x, name='foo'),
# This dollar is ok as it is escaped
re_path(r'^\$', include([
path('bar/', lambda x: x, name='bar'),
])),
]
|
16264104a4173e555ab84592f9377396e165accedd646aa3461ca69316f6f730 | urlpatterns = []
handler400 = __name__ + '.good_handler'
handler403 = __name__ + '.good_handler'
handler404 = __name__ + '.good_handler'
handler500 = __name__ + '.good_handler'
def good_handler(request, exception=None, foo='bar'):
pass
|
14b94b22ff4ccbe541ac99180a6323472afe34ee682bf62153687f6bdbab9075 | from django.conf.urls.i18n import i18n_patterns
from django.urls import path
from django.utils.translation import gettext_lazy as _
urlpatterns = i18n_patterns(
path(_('translated/'), lambda x: x, name='i18n_prefixed'),
)
|
5b4518233983233ce44557c2672845d918aeba4afb6b76b3a869b247dd6dc5e5 | import os
import re
from io import StringIO
from django.contrib.gis.gdal import GDAL_VERSION, Driver, GDALException
from django.contrib.gis.utils.ogrinspect import ogrinspect
from django.core.management import call_command
from django.db import connection, connections
from django.test import SimpleTestCase, TestCase, ... |
749197269dec5ce41fcb928b6d43401baa2683538b4939b10688be2afe925331 | import datetime
import os
import unittest
from copy import copy
from decimal import Decimal
from django.conf import settings
from django.contrib.gis.gdal import DataSource
from django.contrib.gis.utils.layermapping import (
InvalidDecimal, InvalidString, LayerMapError, LayerMapping,
MissingForeignKey,
)
from d... |
a3d5c514a34b7e4f3658439e38e3435a715415975728446fd688e4c3bf5bc9b8 | from django.contrib.gis.db import models
class NamedModel(models.Model):
name = models.CharField(max_length=25)
class Meta:
abstract = True
def __str__(self):
return self.name
class State(NamedModel):
pass
class County(NamedModel):
state = models.ForeignKey(State, models.CASC... |
7de726894e2c7c263d38fe54cb9708bee19dd9271d02be6793e1458076aa8a4e | import json
from django.contrib.gis.db.models.fields import BaseSpatialField
from django.contrib.gis.db.models.functions import Distance
from django.contrib.gis.db.models.lookups import DistanceLookupBase, GISLookup
from django.contrib.gis.gdal import GDALRaster
from django.contrib.gis.geos import GEOSGeometry
from dj... |
37f874e888664d3ff05893b21ed1040e0977b90891912a3c9ad3092a11cb5ae1 | import json
import math
import re
from decimal import Decimal
from django.contrib.gis.db.models import functions
from django.contrib.gis.geos import (
GEOSGeometry, LineString, Point, Polygon, fromstr,
)
from django.contrib.gis.measure import Area
from django.db import NotSupportedError, connection
from django.db.... |
4c0d17cc0be866a26ccc565bb786818406f635e274e506f7ef83cae6fcf239e2 | import tempfile
import unittest
from io import StringIO
from django.contrib.gis import gdal
from django.contrib.gis.db.models import Extent, MakeLine, Union, functions
from django.contrib.gis.geos import (
GeometryCollection, GEOSGeometry, LinearRing, LineString, MultiLineString,
MultiPoint, MultiPolygon, Poin... |
f5a75afb79c12481efc0a42d3b515bb85ab972db1be25394dcce3192649a6c46 | from xml.dom import minidom
from django.conf import settings
from django.contrib.sites.models import Site
from django.test import TestCase, modify_settings, override_settings
from .models import City
@modify_settings(INSTALLED_APPS={'append': 'django.contrib.sites'})
@override_settings(ROOT_URLCONF='gis_tests.geoap... |
3465defe8bae677523173d2571cc32d3a1f2d9ddcaf4f3943380702cdc59d88b | from django.contrib.gis.sitemaps import KMLSitemap, KMZSitemap
from .models import City, Country
sitemaps = {
'kml': KMLSitemap([City, Country]),
'kmz': KMZSitemap([City, Country]),
}
|
132eff815e6729b6c07c275452de355d524ab5e24666b2d32be5215429427da4 | from django.contrib.gis import views as gis_views
from django.contrib.gis.sitemaps import views as gis_sitemap_views
from django.contrib.sitemaps import views as sitemap_views
from django.urls import path
from .feeds import feed_dict
from .sitemaps import sitemaps
urlpatterns = [
path('feeds/<path:url>/', gis_vie... |
5fbe21f86942600b04dccb2b3bc8d2baf7cc524f7d2ab75909f67313291b2449 | from datetime import datetime
from django.contrib.gis.db.models import Extent
from django.contrib.gis.shortcuts import render_to_kmz
from django.db.models import Count, Min
from django.test import TestCase, skipUnlessDBFeature
from ..utils import no_oracle
from .models import City, PennsylvaniaCity, State, Truth
cl... |
91d31534bb9e6cf7701244f716dbc268a95ed34ebaf816df0d90fd2c5aae435e | import zipfile
from io import BytesIO
from xml.dom import minidom
from django.conf import settings
from django.contrib.sites.models import Site
from django.test import TestCase, modify_settings, override_settings
from .models import City, Country
@modify_settings(INSTALLED_APPS={'append': ['django.contrib.sites', '... |
d6fc804a839cad61f58e913e146a310309a1bf980e68b3f41c925749139fac24 | """
Tests for geography support in PostGIS
"""
import os
from unittest import skipIf, skipUnless
from django.contrib.gis.db import models
from django.contrib.gis.db.models.functions import Area, Distance
from django.contrib.gis.measure import D
from django.db import NotSupportedError, connection
from django.db.models.... |
766b84ca1aa101b411b5de030c3f81cf043a6bd2e7768be1ea6198c65552e527 | from unittest import skipIf
from django.contrib.gis.db.models import fields
from django.contrib.gis.geos import MultiPolygon, Polygon
from django.core.exceptions import ImproperlyConfigured
from django.db import connection, migrations, models
from django.db.migrations.migration import Migration
from django.db.migratio... |
a54163607bef6389051a350fa04bf3a837f111678d1389a6d13684acaa6b4f6f | # Copyright (c) 2008-2009 Aryeh Leib Taurog, http://www.aryehleib.com
# All rights reserved.
#
# Modified from original contribution by Aryeh Leib Taurog, which was
# released under the New BSD license.
import unittest
from django.contrib.gis.geos.mutable_list import ListMixin
class UserListA(ListMixin):
_mytyp... |
587d3de707a9357454764326811068eb801d89e94062e0184bd7c150374fefb6 | import ctypes
import itertools
import json
import pickle
import random
from binascii import a2b_hex
from io import BytesIO
from unittest import mock
from django.contrib.gis import gdal
from django.contrib.gis.geos import (
GeometryCollection, GEOSException, GEOSGeometry, LinearRing, LineString,
MultiLineString... |
fa331f10fc4d66865d7a48ed3926f84e772504d25e180b18277cfdd175035207 | from django.contrib.gis.db.models import Collect, Count, Extent, F, Union
from django.contrib.gis.geos import GEOSGeometry, MultiPoint, Point
from django.db import NotSupportedError, connection
from django.test import TestCase, skipUnlessDBFeature
from django.test.utils import override_settings
from django.utils import... |
b4c79175ac847e0210c70c1bdbab0b80bc036263bc9ea13dc122992d03daeeb7 | import os
import shutil
import struct
import tempfile
from django.contrib.gis.gdal import GDAL_VERSION, GDALRaster
from django.contrib.gis.gdal.error import GDALException
from django.contrib.gis.gdal.raster.band import GDALBand
from django.contrib.gis.shortcuts import numpy
from django.test import SimpleTestCase
from... |
d0b928a2cd1fe422c3a64a5526d3f40bba3886f0c869404eab931fe90fd180df | import os
import re
from datetime import datetime
from django.contrib.gis.gdal import (
DataSource, Envelope, GDALException, OGRGeometry,
)
from django.contrib.gis.gdal.field import (
OFTDateTime, OFTInteger, OFTReal, OFTString,
)
from django.test import SimpleTestCase
from ..test_data import TEST_DATA, TestD... |
47d2cbe9a6771e18abe2c5a12e3d920551c7207dbf33bf74e13979a89626b4e8 | from django.contrib.gis import admin
from django.contrib.gis.geos import Point
from django.test import SimpleTestCase, override_settings
from .admin import UnmodifiableAdmin
from .models import City, site
@override_settings(ROOT_URLCONF='django.contrib.gis.tests.geoadmin.urls')
class GeoAdminTest(SimpleTestCase):
... |
cf7aea23ee4690db17c417dab357ae39ca52deb078a200586a9e6022c5f2b852 | from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('admin/', include(admin.site.urls)),
]
|
12aa7ecde3e11ec2267a41ea71828d23e96357fe59363b4fbd359f7c9ac97be2 | from django.core.management.base import BaseCommand
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument("--list", action="store_true", help="Print all options")
def handle(self, *args, **options):
pass
|
cb5e19c0dc0ffe9ec56da8872b329f8eed4522e0df57207f89c24756830a9888 | 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 ... |
9d78a5b61d44a6626debe3a95a77a55a93cbe92308d216b8db65515e444fb336 | 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,... |
a65db5dff34b97fe0356923b9c997632bc25bb763794592515141d42efede179 | from unittest import mock
from django.db import migrations
try:
from django.contrib.postgres.operations import CryptoExtension
except ImportError:
CryptoExtension = mock.Mock()
class Migration(migrations.Migration):
# Required for the SHA database functions.
operations = [CryptoExtension()]
|
ccecdbc6cca78ce2e98ffd2264650eedb59e959268e4db7419cb7c022f151a0b | from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('db_functions', '0001_setup_extensions'),
]
operations = [
migrations.CreateModel(
name='Author',
fields=[
('name', models.CharField(max_length=50)),
... |
1a9a43b6df640fbe6645bb0d881a940965c7c92846e8fa765ffda348717d6b30 | from django.db import connection
from django.db.models import CharField
from django.db.models.functions import SHA512
from django.test import TestCase
from django.test.utils import register_lookup
from ..models import Author
class SHA512Tests(TestCase):
@classmethod
def setUpTestData(cls):
Author.obj... |
38e50f37c4db6bde9fef55ff5aec16f87791d866f495a7e6fa2648bc3cba1b3e | from django.db.models import Value
from django.db.models.functions import StrIndex
from django.test import TestCase
from django.utils import timezone
from ..models import Article, Author
class StrIndexTests(TestCase):
def test_annotate_charfield(self):
Author.objects.create(name='George. R. R. Martin')
... |
21c557048050c6e79e3f9837e08bf79be075518f27cfe8a4374cce401263b66b | from django.db import connection
from django.db.models import CharField
from django.db.models.functions import Length, Reverse, Trim
from django.test import TestCase
from django.test.utils import register_lookup
from ..models import Author
class ReverseTests(TestCase):
@classmethod
def setUpTestData(cls):
... |
57b9a4c5efc7be302cf290ebe5482053ec32f648fc2899cc298b25822b38a81f | from django.db.models import IntegerField
from django.db.models.functions import Chr, Left, Ord
from django.test import TestCase
from django.test.utils import register_lookup
from ..models import Author
class ChrTests(TestCase):
@classmethod
def setUpTestData(cls):
cls.john = Author.objects.create(na... |
a7e136d8dbfdd4e76b341ddc60eef223e0660b93f4085a741ea7b5c0f144462d | from django.db import connection
from django.db.models import CharField, Value
from django.db.models.functions import Length, Repeat
from django.test import TestCase
from ..models import Author
class RepeatTests(TestCase):
def test_basic(self):
Author.objects.create(name='John', alias='xyz')
none... |
cc25fe53a9ba14cdf8bc04707d7f186d76dd6412b2d546c32c724bc9fe6bc597 | from django.db import connection
from django.db.models import CharField
from django.db.models.functions import SHA256
from django.test import TestCase
from django.test.utils import register_lookup
from ..models import Author
class SHA256Tests(TestCase):
@classmethod
def setUpTestData(cls):
Author.obj... |
341cf8ea6e819eb28b5a5bea606206ceca98e8a0ad0fab03bd1468d34e26046c | from django.db import connection
from django.db.models import CharField
from django.db.models.functions import SHA384
from django.test import TestCase
from django.test.utils import register_lookup
from ..models import Author
class SHA384Tests(TestCase):
@classmethod
def setUpTestData(cls):
Author.obj... |
8c3f8374d076fe89d816e65b5a0e803481654ae599bec4b759b7cd5526ae19d0 | import unittest
from django.db import connection
from django.db.models import CharField
from django.db.models.functions import SHA224
from django.db.utils import NotSupportedError
from django.test import TestCase
from django.test.utils import register_lookup
from ..models import Author
class SHA224Tests(TestCase):
... |
d75ad24052c7c9b948176f2d14527b8fa41b7e75bc155ef811c72c4fc3249a63 | from django.db.models import CharField
from django.db.models.functions import Lower
from django.test import TestCase
from django.test.utils import register_lookup
from ..models import Author
class LowerTests(TestCase):
def test_basic(self):
Author.objects.create(name='John Smith', alias='smithj')
... |
fe6e95c7ab632c92880e42348f648a0d26a924308c1c6068a24a9ed504199879 | from django.db.models import CharField, Value
from django.db.models.functions import Lower, Right
from django.test import TestCase
from ..models import Author
class RightTests(TestCase):
@classmethod
def setUpTestData(cls):
Author.objects.create(name='John Smith', alias='smithj')
Author.objec... |
082e1de45c30be8057ab702cff7390f468bbfd889e94c14868c6f06f1f85feff | from django.db.models import F, Value
from django.db.models.functions import Concat, Replace
from django.test import TestCase
from ..models import Author
class ReplaceTests(TestCase):
@classmethod
def setUpTestData(cls):
Author.objects.create(name='George R. R. Martin')
Author.objects.create... |
ccf44c113276a55b3fb396985eb8bf467dfe15da449b0ca77f8abbf186e833e3 | from django.db.models import CharField, Value
from django.db.models.functions import Left, Lower
from django.test import TestCase
from ..models import Author
class LeftTests(TestCase):
@classmethod
def setUpTestData(cls):
Author.objects.create(name='John Smith', alias='smithj')
Author.objects... |
e877ebe530474390b2fa99b1efeff1307a86b9ef9032ad779127acc929510754 | from unittest import skipUnless
from django.db import connection
from django.db.models import CharField, TextField, Value as V
from django.db.models.functions import Concat, ConcatPair, Upper
from django.test import TestCase
from django.utils import timezone
from ..models import Article, Author
lorem_ipsum = """
... |
4b48a7a138f0da7e2d7b3aed8adfbd326079926748af3827fcc12bdd53f4ffd3 | from django.db import connection
from django.db.models import CharField
from django.db.models.functions import SHA1
from django.test import TestCase
from django.test.utils import register_lookup
from ..models import Author
class SHA1Tests(TestCase):
@classmethod
def setUpTestData(cls):
Author.objects... |
1267fac7d5a675090a25597cef7fcda1277a08631c9b196d2cb55e93e064d5b4 | from django.db.models import CharField, Value
from django.db.models.functions import Left, Ord
from django.test import TestCase
from django.test.utils import register_lookup
from ..models import Author
class OrdTests(TestCase):
@classmethod
def setUpTestData(cls):
cls.john = Author.objects.create(nam... |
52bb9f005283a9621cded296eb5b9623768f6b0c04f2134572749c0899465c8e | from django.db.models import CharField
from django.db.models.functions import Length
from django.test import TestCase
from django.test.utils import register_lookup
from ..models import Author
class LengthTests(TestCase):
def test_basic(self):
Author.objects.create(name='John Smith', alias='smithj')
... |
ad3e390c28207f385bc2c1b9f63545049e32b81b34c34bab51a54dd405aeaf5b | from django.db.models import CharField
from django.db.models.functions import Upper
from django.test import TestCase
from django.test.utils import register_lookup
from ..models import Author
class UpperTests(TestCase):
def test_basic(self):
Author.objects.create(name='John Smith', alias='smithj')
... |
2c5ab6e3f14bba5e144a11f7f9a3d5bf6686f52109c456f0d0e0b4db931c6339 | from django.db.models import CharField, Value as V
from django.db.models.functions import Lower, StrIndex, Substr, Upper
from django.test import TestCase
from ..models import Author
class SubstrTests(TestCase):
def test_basic(self):
Author.objects.create(name='John Smith', alias='smithj')
Author... |
cc4c3215376fae98f15b609622ab3bcd55b9e09c2b64e27769b3806cbd1d7fa6 | from django.db.models import CharField
from django.db.models.functions import LTrim, RTrim, Trim
from django.test import TestCase
from django.test.utils import register_lookup
from ..models import Author
class TrimTests(TestCase):
def test_trim(self):
Author.objects.create(name=' John ', alias='j')
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.