Convert the remainder of the relative imports in the tests to be absolute imports.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16981 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Alex Gaynor 2011-10-13 21:34:56 +00:00
parent f830166167
commit 8c0eefd066
144 changed files with 580 additions and 265 deletions

View File

@ -1,9 +1,12 @@
from __future__ import absolute_import
from django.contrib import admin
from django.contrib.contenttypes import generic
from models import (Media, PhoneNumber, Episode, EpisodeExtra, Contact,
from .models import (Media, PhoneNumber, Episode, EpisodeExtra, Contact,
Category, EpisodePermanent, EpisodeMaxNum)
site = admin.AdminSite(name="admin")
class MediaInline(generic.GenericTabularInline):

View File

@ -1,6 +1,6 @@
from django.db import models
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.db import models
class Episode(models.Model):

View File

@ -1,5 +1,7 @@
# coding: utf-8
from __future__ import absolute_import
from django.conf import settings
from django.contrib import admin
from django.contrib.admin.sites import AdminSite
@ -9,9 +11,9 @@ from django.forms.models import ModelForm
from django.test import TestCase
# local test models
from models import (Episode, EpisodeExtra, EpisodeMaxNum, Media,
from .admin import MediaInline, MediaPermanentInline
from .models import (Episode, EpisodeExtra, EpisodeMaxNum, Media,
EpisodePermanent, Category)
from admin import MediaInline, MediaPermanentInline
class GenericAdminViewTest(TestCase):

View File

@ -1,6 +1,8 @@
from __future__ import absolute_import
from django.conf.urls import patterns, include
import admin
from . import admin
urlpatterns = patterns('',
(r'^generic_inline_admin/admin/', include(admin.site.urls)),

View File

@ -1,6 +1,7 @@
from django.db import models
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.db import models
__all__ = ('Link', 'Place', 'Restaurant', 'Person', 'Address',
'CharLink', 'TextLink', 'OddRelation1', 'OddRelation2',

View File

@ -1,6 +1,9 @@
from django.test import TestCase
from django.db.models import Q
from models import *
from django.test import TestCase
from .models import (Address, Place, Restaurant, Link, CharLink, TextLink,
Person, Contact, Note, Organization, OddRelation1, OddRelation2)
class GenericRelationTests(TestCase):

View File

@ -1,9 +1,9 @@
import time
import unittest
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpResponse
from django.test import TestCase, RequestFactory
from django.utils import unittest
from django.views.generic import View, TemplateView, RedirectView

View File

@ -1,9 +1,12 @@
from __future__ import absolute_import
import datetime
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from regressiontests.generic_views.models import Book
from .models import Book
class ArchiveIndexViewTests(TestCase):
fixtures = ['generic-views-test-data.json']

View File

@ -1,7 +1,9 @@
from __future__ import absolute_import
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from regressiontests.generic_views.models import Artist, Author, Page
from .models import Artist, Author, Page
class DetailViewTest(TestCase):

View File

@ -1,11 +1,14 @@
from __future__ import absolute_import
from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers import reverse
from django import forms
from django.test import TestCase
from django.utils.unittest import expectedFailure
from regressiontests.generic_views.models import Artist, Author
from regressiontests.generic_views import views
from . import views
from .models import Artist, Author
class ModelFormMixinTests(TestCase):
def test_get_form(self):

View File

@ -1,6 +1,8 @@
from __future__ import absolute_import
from django import forms
from regressiontests.generic_views.models import Author
from .models import Author
class AuthorForm(forms.ModelForm):

View File

@ -1,7 +1,10 @@
from __future__ import absolute_import
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from regressiontests.generic_views.models import Author, Artist
from .models import Author, Artist
class ListViewTests(TestCase):
fixtures = ['generic-views-test-data.json']

View File

@ -1,5 +1,6 @@
from django.db import models
class Artist(models.Model):
name = models.CharField(max_length=100)

View File

@ -1,5 +1,10 @@
from regressiontests.generic_views.base import ViewTest, TemplateViewTest, RedirectViewTest
from regressiontests.generic_views.dates import ArchiveIndexViewTests, YearArchiveViewTests, MonthArchiveViewTests, WeekArchiveViewTests, DayArchiveViewTests, DateDetailViewTests
from regressiontests.generic_views.detail import DetailViewTest
from regressiontests.generic_views.edit import ModelFormMixinTests, CreateViewTests, UpdateViewTests, DeleteViewTests
from regressiontests.generic_views.list import ListViewTests
from __future__ import absolute_import
from .base import ViewTest, TemplateViewTest, RedirectViewTest
from .dates import (ArchiveIndexViewTests, YearArchiveViewTests,
MonthArchiveViewTests, WeekArchiveViewTests, DayArchiveViewTests,
DateDetailViewTests)
from .detail import DetailViewTest
from .edit import (ModelFormMixinTests, CreateViewTests, UpdateViewTests,
DeleteViewTests)
from .list import ListViewTests

View File

@ -1,8 +1,10 @@
from django.conf.urls import patterns, url
from django.views.generic import TemplateView
from django.views.decorators.cache import cache_page
from __future__ import absolute_import
import views
from django.conf.urls import patterns, url
from django.views.decorators.cache import cache_page
from django.views.generic import TemplateView
from . import views
urlpatterns = patterns('',

View File

@ -1,11 +1,13 @@
from __future__ import absolute_import
from django.contrib.auth.decorators import login_required
from django.core.paginator import Paginator
from django.core.urlresolvers import reverse
from django.utils.decorators import method_decorator
from django.views import generic
from regressiontests.generic_views.models import Artist, Author, Book, Page
from regressiontests.generic_views.forms import AuthorForm
from .forms import AuthorForm
from .models import Artist, Author, Book, Page
class CustomTemplateView(generic.TemplateView):

View File

@ -1,6 +1,8 @@
from __future__ import absolute_import
from django.test import TestCase
from models import Author, Publisher
from .models import Author, Publisher
class GetOrCreateTests(TestCase):

View File

@ -1,7 +1,7 @@
from django.utils import unittest
from django.conf import settings
from django.core.handlers.wsgi import WSGIHandler
from django.test import RequestFactory
from django.utils import unittest
class HandlerTests(unittest.TestCase):

View File

@ -5,6 +5,7 @@ from django.http import (QueryDict, HttpResponse, SimpleCookie, BadHeaderError,
parse_cookie)
from django.utils import unittest
class QueryDictTests(unittest.TestCase):
def test_missing_key(self):
q = QueryDict('')

View File

@ -8,8 +8,8 @@ from django.core.management import CommandError
from django.core.management.commands.compilemessages import compile_messages
from django.test import TestCase
LOCALE='es_AR'
LOCALE='es_AR'
class MessageCompilationTests(TestCase):

View File

@ -2,8 +2,10 @@
import os
import re
import shutil
from django.test import TestCase
from django.core import management
from django.test import TestCase
LOCALE='de'

View File

@ -3,10 +3,10 @@ from __future__ import with_statement
import os
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from django.test.utils import override_settings
from django.utils import translation
from django.contrib.contenttypes.models import ContentType
class ContentTypeTests(TestCase):

View File

@ -1,7 +1,10 @@
from __future__ import absolute_import
from django import forms
from django.forms.extras import SelectDateWidget
from models import Company
from .models import Company
class I18nForm(forms.Form):
decimal_field = forms.DecimalField(localize=True)

View File

@ -1,7 +1,9 @@
from datetime import datetime
from django.db import models
from django.utils.translation import ugettext_lazy as _
class TestModel(models.Model):
text = models.CharField(max_length=10, default=_('Anything'))

View File

@ -1,5 +1,5 @@
from os.path import join, normpath, abspath, dirname
import warnings
from os.path import join, normpath, abspath, dirname
import django
from django.conf import settings

View File

@ -1,5 +1,6 @@
# -*- encoding: utf-8 -*-
from __future__ import with_statement
from __future__ import with_statement, absolute_import
import datetime
import decimal
import os
@ -10,24 +11,24 @@ from django.conf import settings
from django.template import Template, Context
from django.test import TestCase, RequestFactory
from django.test.utils import override_settings
from django.utils import translation
from django.utils.formats import (get_format, date_format, time_format,
localize, localize_input, iter_format_modules, get_format_modules)
from django.utils.importlib import import_module
from django.utils.numberformat import format as nformat
from django.utils.safestring import mark_safe, SafeString, SafeUnicode
from django.utils import translation
from django.utils.translation import (ugettext, ugettext_lazy, activate,
deactivate, gettext_lazy, pgettext, npgettext, to_locale,
get_language_info, get_language, get_language_from_request)
from forms import I18nForm, SelectDateForm, SelectDateWidget, CompanyForm
from models import Company, TestModel
from .commands.tests import NoWrapExtractorTests, IgnoredExtractorTests, MessageCompilationTests, PoFileTests, BasicExtractorTests, JavascriptExtractorTests, CopyPluralFormsExtractorTests, SymlinkExtractorTests, ExtractorTests
from .contenttypes.tests import ContentTypeTests
from .forms import I18nForm, SelectDateForm, SelectDateWidget, CompanyForm
from .models import Company, TestModel
from .patterns.tests import URLRedirectWithoutTrailingSlashTests, URLTranslationTests, URLDisabledTests, URLTagTests, URLTestCaseBase, URLRedirectWithoutTrailingSlashSettingTests, URLNamespaceTests, URLPrefixTests, URLResponseTests, URLRedirectTests
from .test_warnings import DeprecationWarningTests
from commands.tests import *
from patterns.tests import *
from contenttypes.tests import *
from test_warnings import DeprecationWarningTests
here = os.path.dirname(os.path.abspath(__file__))

View File

@ -4,6 +4,7 @@ Regression tests for initial SQL insertion.
from django.db import models
class Simple(models.Model):
name = models.CharField(max_length = 50)

View File

@ -1,6 +1,6 @@
from django.test import TestCase
from models import Simple
from .models import Simple
class InitialSQLTests(TestCase):

View File

@ -1,7 +1,9 @@
from __future__ import absolute_import
from django.forms.models import inlineformset_factory
from django.test import TestCase
from regressiontests.inline_formsets.models import Poet, Poem, School, Parent, Child
from .models import Poet, Poem, School, Parent, Child
class DeletionTests(TestCase):

View File

@ -1,5 +1,6 @@
from django.db import models
class Reporter(models.Model):
first_name = models.CharField(max_length=30)
last_name = models.CharField(max_length=30)

View File

@ -1,8 +1,11 @@
from __future__ import absolute_import
from functools import update_wrapper
from django.db import connection
from django.test import TestCase, skipUnlessDBFeature
from models import Reporter, Article
from .models import Reporter, Article
#
# The introspection module is optional, so methods tested here might raise

View File

@ -1,5 +1,9 @@
from __future__ import absolute_import
from django.forms import ModelForm
from models import AustralianPlace
from .models import AustralianPlace
class AustralianPlaceForm(ModelForm):
""" Form for storing an Australian place. """

View File

@ -1,5 +1,5 @@
from django.db import models
from django.contrib.localflavor.au.models import AUStateField, AUPostCodeField
from django.db import models
class AustralianPlace(models.Model):
state = AUStateField(blank=True)

View File

@ -1,10 +1,13 @@
from __future__ import absolute_import
import re
from django.test import SimpleTestCase
from django.contrib.localflavor.au.forms import (AUPostCodeField,
AUPhoneNumberField, AUStateSelect)
from forms import AustralianPlaceForm
from .forms import AustralianPlaceForm
SELECTED_OPTION_PATTERN = r'<option value="%s" selected="selected">'
BLANK_OPTION_PATTERN = r'<option value="">'

View File

@ -1,5 +1,9 @@
from __future__ import absolute_import
from django.forms import ModelForm
from models import MKPerson
from .models import MKPerson
class MKPersonForm(ModelForm):

View File

@ -1,6 +1,7 @@
from django.db import models
from django.contrib.localflavor.mk.models import (
MKIdentityCardNumberField, MKMunicipalityField, UMCNField)
from django.db import models
class MKPerson(models.Model):
first_name = models.CharField(max_length = 20)

View File

@ -1,10 +1,13 @@
from __future__ import absolute_import
from django.contrib.localflavor.mk.forms import (
MKIdentityCardNumberField, MKMunicipalitySelect, UMCNField)
from django.test import SimpleTestCase
from forms import MKPersonForm
from .forms import MKPersonForm
class MKLocalflavorTests(SimpleTestCase):
class MKLocalFlavorTests(SimpleTestCase):
def setUp(self):
self.form = MKPersonForm({

View File

@ -1,5 +1,9 @@
from __future__ import absolute_import
from django.forms import ModelForm
from models import MXPersonProfile
from .models import MXPersonProfile
class MXPersonProfileForm(ModelForm):

View File

@ -1,6 +1,7 @@
from django.db import models
from django.contrib.localflavor.mx.models import (
MXStateField, MXRFCField, MXCURPField, MXZipCodeField)
from django.db import models
class MXPersonProfile(models.Model):
state = MXStateField()

View File

@ -1,9 +1,12 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from django.contrib.localflavor.mx.forms import (MXZipCodeField, MXRFCField,
MXStateSelect, MXCURPField)
from django.test import SimpleTestCase
from forms import MXPersonProfileForm
from .forms import MXPersonProfileForm
class MXLocalFlavorTests(SimpleTestCase):

View File

@ -1,42 +1,44 @@
from ar.tests import *
from at.tests import *
from au.tests import *
from be.tests import *
from br.tests import *
from ca.tests import *
from ch.tests import *
from cl.tests import *
from cn.tests import *
from co.tests import *
from cz.tests import *
from de.tests import *
from ec.tests import *
from es.tests import *
from fi.tests import *
from fr.tests import *
from gb.tests import *
from generic.tests import *
from hr.tests import *
from id.tests import *
from ie.tests import *
from il.tests import *
from in_.tests import *
from is_.tests import *
from it.tests import *
from jp.tests import *
from kw.tests import *
from mk.tests import *
from mx.tests import *
from nl.tests import *
from pl.tests import *
from pt.tests import *
from py.tests import *
from ro.tests import *
from ru.tests import *
from se.tests import *
from si.tests import *
from sk.tests import *
from tr.tests import *
from us.tests import *
from uy.tests import *
from za.tests import *
from __future__ import absolute_import
from .ar.tests import ARLocalFlavorTests
from .at.tests import ATLocalFlavorTests
from .au.tests import AULocalflavorTests
from .be.tests import BELocalFlavorTests
from .br.tests import BRLocalFlavorTests
from .ca.tests import CALocalFlavorTests
from .ch.tests import CHLocalFlavorTests
from .cl.tests import CLLocalFlavorTests
from .cn.tests import CNLocalFlavorTests
from .co.tests import COLocalFlavorTests
from .cz.tests import CZLocalFlavorTests
from .de.tests import DELocalFlavorTests
from .ec.tests import ECLocalFlavorTests
from .es.tests import ESLocalFlavorTests
from .fi.tests import FILocalFlavorTests
from .fr.tests import FRLocalFlavorTests
from .gb.tests import GBLocalFlavorTests
from .generic.tests import GenericLocalFlavorTests
from .hr.tests import HRLocalFlavorTests
from .id.tests import IDLocalFlavorTests
from .ie.tests import IELocalFlavorTests
from .il.tests import ILLocalFlavorTests
from .in_.tests import INLocalFlavorTests
from .is_.tests import ISLocalFlavorTests
from .it.tests import ITLocalFlavorTests
from .jp.tests import JPLocalFlavorTests
from .kw.tests import KWLocalFlavorTests
from .mk.tests import MKLocalFlavorTests
from .mx.tests import MXLocalFlavorTests
from .nl.tests import NLLocalFlavorTests
from .pl.tests import PLLocalFlavorTests
from .pt.tests import PTLocalFlavorTests
from .py.tests import PYLocalFlavorTests
from .ro.tests import ROLocalFlavorTests
from .ru.tests import RULocalFlavorTests
from .se.tests import SELocalFlavorTests
from .si.tests import SILocalFlavorTests
from .sk.tests import SKLocalFlavorTests
from .tr.tests import TRLocalFlavorTests
from .us.tests import USLocalFlavorTests
from .uy.tests import UYLocalFlavorTests
from .za.tests import ZALocalFlavorTests

View File

@ -1,5 +1,9 @@
from __future__ import absolute_import
from django.forms import ModelForm
from models import USPlace
from .models import USPlace
class USPlaceForm(ModelForm):

View File

@ -1,6 +1,5 @@
from django.contrib.localflavor.us.models import USStateField, USPostalCodeField
from django.db import models
from django.contrib.localflavor.us.models import USStateField
from django.contrib.localflavor.us.models import USPostalCodeField
# When creating models you need to remember to add a app_label as
# 'localflavor', so your model can be found

View File

@ -1,11 +1,14 @@
from __future__ import absolute_import
from django.contrib.localflavor.us.forms import (USZipCodeField,
USPhoneNumberField, USStateField, USStateSelect,
USSocialSecurityNumberField)
from django.test import SimpleTestCase
from forms import USPlaceForm
from .forms import USPlaceForm
class USLocalflavorTests(SimpleTestCase):
class USLocalFlavorTests(SimpleTestCase):
def setUp(self):
self.form = USPlaceForm({'state':'GA', 'state_req':'NC', 'postal_code': 'GA', 'name':'impossible'})

View File

@ -3,11 +3,11 @@ from __future__ import with_statement
import copy
from django.conf import compat_patch_logging_config
from django.test import TestCase
from django.utils.log import CallbackFilter, RequireDebugFalse, getLogger
from django.test.utils import override_settings
from django.core import mail
from django.test import TestCase
from django.test.utils import override_settings
from django.utils.log import CallbackFilter, RequireDebugFalse, getLogger
# logging config prior to using filter with mail_admins

View File

@ -1,5 +1,5 @@
from django.db import models
from django.contrib.auth import models as auth
from django.db import models
# No related name is needed here, since symmetrical relations are not
# explicitly reversible.

View File

@ -1,7 +1,9 @@
from __future__ import absolute_import
from django.core.exceptions import FieldError
from django.test import TestCase
from models import (SelfRefer, Tag, TagCollection, Entry, SelfReferChild,
from .models import (SelfRefer, Tag, TagCollection, Entry, SelfReferChild,
SelfReferChildSibling, Worksheet)

View File

@ -1,6 +1,5 @@
from django.db import models
from django.contrib.auth.models import User
from django.db import models
# Forward declared intermediate model

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
try:
from cStringIO import StringIO
except ImportError:
@ -7,8 +9,8 @@ from django.core import management
from django.contrib.auth.models import User
from django.test import TestCase
from models import (Person, Group, Membership, UserMembership,
Car, Driver, CarDriver)
from .models import (Person, Group, Membership, UserMembership, Car, Driver,
CarDriver)
class M2MThroughTestCase(TestCase):

View File

@ -4,6 +4,7 @@ Various edge-cases for model managers.
from django.db import models
class OnlyFred(models.Manager):
def get_query_set(self):
return super(OnlyFred, self).get_query_set().filter(name='fred')

View File

@ -1,6 +1,8 @@
from __future__ import absolute_import
from django.test import TestCase
from models import Child1, Child2, Child3, Child4, Child5, Child6, Child7
from .models import Child1, Child2, Child3, Child4, Child5, Child6, Child7
class ManagersRegressionTests(TestCase):

View File

@ -1,7 +1,10 @@
from __future__ import absolute_import
from django.db import models
from django.test import TestCase
from models import First, Second, Third, Parent, Child, Category, Record, Relation
from .models import First, Second, Third, Parent, Child, Category, Record, Relation
class ManyToOneRegressionTests(TestCase):
def test_object_creation(self):

View File

@ -1,5 +1,6 @@
from django.db import models
class PersonWithDefaultMaxLengths(models.Model):
email = models.EmailField()
vcard = models.FileField(upload_to='/tmp')

View File

@ -1,6 +1,9 @@
from __future__ import absolute_import
from django.utils import unittest
from regressiontests.max_lengths.models import PersonWithDefaultMaxLengths, PersonWithCustomMaxLengths
from .models import PersonWithDefaultMaxLengths, PersonWithCustomMaxLengths
class MaxLengthArgumentsTests(unittest.TestCase):

View File

@ -1,7 +1,9 @@
# coding: utf-8
from __future__ import absolute_import
from django.conf.urls import patterns
import views
from . import views
urlpatterns = patterns('',
(r'^middleware_exceptions/view/$', views.normal_view),

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
import os
import shutil
@ -5,14 +7,14 @@ from django.core.files import File
from django.core.files.images import ImageFile
from django.test import TestCase
from models import (Image, Person, PersonWithHeight, PersonWithHeightAndWidth,
from .models import (Image, Person, PersonWithHeight, PersonWithHeightAndWidth,
PersonDimensionsFirst, PersonTwoImages, TestImageFieldFile)
# If PIL available, do these tests.
if Image:
from models import temp_storage_dir
from .models import temp_storage_dir
class ImageFieldTestMixin(object):

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
import datetime
from decimal import Decimal
@ -8,14 +10,15 @@ from django.db import models
from django.db.models.fields.files import FieldFile
from django.utils import unittest
from models import Foo, Bar, Whiz, BigD, BigS, Image, BigInt, Post, NullBooleanModel, BooleanModel, Document, RenamedField
from .models import (Foo, Bar, Whiz, BigD, BigS, Image, BigInt, Post,
NullBooleanModel, BooleanModel, Document, RenamedField)
# If PIL available, do these tests.
if Image:
from imagefield import (
ImageFieldTests, ImageFieldTwoDimensionsTests, TwoImageFieldTests,
ImageFieldNoDimensionsTests, ImageFieldOneDimensionTests,
ImageFieldDimensionsFirstTests, ImageFieldUsingFileTests)
from .imagefield import (ImageFieldTests, ImageFieldTwoDimensionsTests,
TwoImageFieldTests, ImageFieldNoDimensionsTests,
ImageFieldOneDimensionTests, ImageFieldDimensionsFirstTests,
ImageFieldUsingFileTests)
class BasicFieldTests(test.TestCase):

View File

@ -1,6 +1,7 @@
import os
from django.db import models
from django.core.exceptions import ValidationError
from django.db import models
class Person(models.Model):

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
from datetime import date
from django import forms
@ -8,7 +10,7 @@ from django.forms.models import (modelform_factory, ModelChoiceField,
from django.utils import unittest
from django.test import TestCase
from models import (Person, RealPerson, Triple, FilePathModel, Article,
from .models import (Person, RealPerson, Triple, FilePathModel, Article,
Publication, CustomFF, Author, Author1, Homepage, Document, Edition)

View File

@ -1,5 +1,6 @@
from django.db import models
class User(models.Model):
username = models.CharField(max_length=12, unique=True)
serial = models.IntegerField()

View File

@ -1,10 +1,12 @@
from __future__ import absolute_import
from django import forms
from django.forms.formsets import BaseFormSet, DELETION_FIELD_NAME
from django.forms.util import ErrorDict, ErrorList
from django.forms.models import modelform_factory, inlineformset_factory, modelformset_factory, BaseModelFormSet
from django.test import TestCase
from models import User, UserSite, Restaurant, Manager, Network, Host
from .models import User, UserSite, Restaurant, Manager, Network, Host
class InlineFormsetTests(TestCase):

View File

@ -2,12 +2,14 @@
Regression tests for Model inheritance behaviour.
"""
from __future__ import absolute_import
import datetime
from operator import attrgetter
from django.test import TestCase
from models import (Place, Restaurant, ItalianRestaurant, ParkingLot,
from .models import (Place, Restaurant, ItalianRestaurant, ParkingLot,
ParkingLot2, ParkingLot3, Supplier, Wholesaler, Child, SelfRefParent,
SelfRefChild, ArticleWithAuthor, M2MChild, QualityControl, DerivedM,
Person, BirthdayParty, BachelorParty, MessyBachelorParty,

View File

@ -5,6 +5,7 @@ select_related().
from django.db import models
class Place(models.Model):
name = models.CharField(max_length=50)

View File

@ -1,8 +1,10 @@
from __future__ import absolute_import
from operator import attrgetter
from django.test import TestCase
from models import Restaurant, Person
from .models import Restaurant, Person
class ModelInheritanceSelectRelatedTests(TestCase):

View File

@ -1,5 +1,6 @@
from django.db import models
class Guitarist(models.Model):
name = models.CharField(max_length=50)
slug = models.CharField(max_length=50)

View File

@ -1,5 +1,9 @@
from __future__ import absolute_import
from django.test import TestCase
from regressiontests.model_permalink.models import Guitarist
from .models import Guitarist
class PermalinkTests(TestCase):
urls = 'regressiontests.model_permalink.urls'

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
import datetime
from operator import attrgetter
@ -5,7 +7,7 @@ from django.core.exceptions import ValidationError
from django.test import TestCase, skipUnlessDBFeature
from django.utils import tzinfo
from models import (Worker, Article, Party, Event, Department,
from .models import (Worker, Article, Party, Event, Department,
BrokenUnicodeMethod, NonAutoPK)

View File

@ -1,6 +1,7 @@
# coding: utf-8
from django.db import models
from django.contrib.auth.models import User
from django.db import models
class Band(models.Model):
name = models.CharField(max_length=100)

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
from datetime import date
from django import forms
@ -15,8 +17,7 @@ from django.forms.widgets import Select
from django.test import TestCase
from django.utils import unittest
from models import (Band, Concert, ValidationTestModel,
ValidationTestInlineModel)
from .models import Band, Concert, ValidationTestModel, ValidationTestInlineModel
class MockRequest(object):

View File

@ -1,8 +1,11 @@
from __future__ import absolute_import
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from django.db import models
class Review(models.Model):
source = models.CharField(max_length=100)
content_type = models.ForeignKey(ContentType)

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
import datetime
import pickle
from StringIO import StringIO
@ -9,7 +11,7 @@ from django.db import connections, router, DEFAULT_DB_ALIAS
from django.db.models import signals
from django.test import TestCase
from models import Book, Person, Pet, Review, UserProfile
from .models import Book, Person, Pet, Review, UserProfile
class QueryTestCase(TestCase):

View File

@ -4,6 +4,7 @@ Regression tests for proper working of ForeignKey(null=True).
from django.db import models
class SystemDetails(models.Model):
details = models.TextField()

View File

@ -1,7 +1,11 @@
from django.test import TestCase
from django.db.models import Q
from __future__ import absolute_import
from django.db.models import Q
from django.test import TestCase
from .models import (SystemDetails, Item, PropertyValue, SystemInfo, Forum,
Post, Comment)
from regressiontests.null_fk.models import *
class NullFkTests(TestCase):

View File

@ -8,6 +8,7 @@ xpected results
from django.db import models
# The first two models represent a very simple null FK ordering case.
class Author(models.Model):
name = models.CharField(max_length=150)

View File

@ -1,6 +1,9 @@
from __future__ import absolute_import
from django.test import TestCase
from regressiontests.null_fk_ordering.models import *
from .models import Author, Article, SystemInfo, Forum, Post, Comment
class NullFkOrderingTests(TestCase):

View File

@ -1,5 +1,6 @@
from django.db import models
class Poll(models.Model):
question = models.CharField(max_length=200)

View File

@ -1,7 +1,9 @@
from __future__ import absolute_import
from django.test import TestCase
from django.core.exceptions import FieldError
from regressiontests.null_queries.models import *
from .models import Poll, Choice, OuterA, Inner, OuterB
class NullQueriesTests(TestCase):

View File

@ -1,5 +1,6 @@
from django.db import models
class Place(models.Model):
name = models.CharField(max_length=50)
address = models.CharField(max_length=80)

View File

@ -1,5 +1,9 @@
from __future__ import absolute_import
from django.test import TestCase
from regressiontests.one_to_one_regress.models import *
from .models import Place, Restaurant, Bar, Favorites, Target, UndergroundBar
class OneToOneRegressionTests(TestCase):

View File

@ -6,6 +6,7 @@ import threading
from django.db import models
class DumbCategory(models.Model):
pass

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
import datetime
import pickle
import sys
@ -11,11 +13,12 @@ from django.test import TestCase, skipUnlessDBFeature
from django.utils import unittest
from django.utils.datastructures import SortedDict
from models import (Annotation, Article, Author, Celebrity, Child, Cover, Detail,
DumbCategory, ExtraInfo, Fan, Item, LeafA, LoopX, LoopZ, ManagedModel,
Member, NamedCategory, Note, Number, Plaything, PointerA, Ranking, Related,
Report, ReservedName, Tag, TvChef, Valid, X, Food, Eaten, Node, ObjectA, ObjectB,
ObjectC, CategoryItem, SimpleCategory, SpecialCategory, OneToOneCategory)
from .models import (Annotation, Article, Author, Celebrity, Child, Cover,
Detail, DumbCategory, ExtraInfo, Fan, Item, LeafA, LoopX, LoopZ,
ManagedModel, Member, NamedCategory, Note, Number, Plaything, PointerA,
Ranking, Related, Report, ReservedName, Tag, TvChef, Valid, X, Food, Eaten,
Node, ObjectA, ObjectB, ObjectC, CategoryItem, SimpleCategory,
SpecialCategory, OneToOneCategory)
class BaseQuerysetTest(TestCase):

View File

@ -1,7 +1,11 @@
from __future__ import absolute_import
import datetime
from django.db import models
from django.utils.translation import ugettext_lazy as _
def standalone_number(self):
return 1

View File

@ -1,9 +1,11 @@
from __future__ import absolute_import
import pickle
import datetime
from django.test import TestCase
from models import Group, Event, Happening
from .models import Group, Event, Happening
class PickleabilityTestCase(TestCase):

View File

@ -1,5 +1,6 @@
from django.db import models
class SourceManager(models.Manager):
def get_query_set(self):
return super(SourceManager, self).get_query_set().filter(is_public=True)

View File

@ -1,6 +1,9 @@
from __future__ import absolute_import
from django.test import TestCase
from regressiontests.reverse_single_related.models import *
from .models import Source, Item
class ReverseSingleRelatedTests(TestCase):
"""

View File

@ -1,6 +1,8 @@
from __future__ import absolute_import
from django.test import TestCase
from models import (User, UserProfile, UserStat, UserStatResult, StatDetails,
from .models import (User, UserProfile, UserStat, UserStatResult, StatDetails,
AdvancedUserStat, Image, Product)
class ReverseSelectRelatedTestCase(TestCase):

View File

@ -1,5 +1,6 @@
from django.db import models
class Building(models.Model):
name = models.CharField(max_length=10)

View File

@ -1,5 +1,11 @@
from __future__ import absolute_import
from django.test import TestCase
from regressiontests.select_related_regress.models import *
from .models import (Building, Child, Device, Port, Item, Country, Connection,
ClientStatus, State, Client, SpecialClient, TUser, Person, Student,
Organizer, Class, Enrollment)
class SelectRelatedRegressTests(TestCase):

View File

@ -8,7 +8,7 @@ forward, backwards and self references.
"""
# This is necessary in Python 2.5 to enable the with statement, in 2.6
# and up it is no longer necessary.
from __future__ import with_statement
from __future__ import with_statement, absolute_import
import datetime
import decimal
@ -19,11 +19,23 @@ except ImportError:
from django.core import serializers
from django.core.serializers import SerializerDoesNotExist
from django.db import connection
from django.db import connection, models
from django.test import TestCase
from django.utils.functional import curry
from models import *
from .models import (BooleanData, CharData, DateData, DateTimeData, EmailData,
FileData, FilePathData, DecimalData, FloatData, IntegerData, IPAddressData,
GenericIPAddressData, NullBooleanData, PhoneData, PositiveIntegerData,
PositiveSmallIntegerData, SlugData, SmallData, TextData, TimeData,
USStateData, GenericData, Anchor, UniqueAnchor, FKData, M2MData, O2OData,
FKSelfData, M2MSelfData, FKDataToField, FKDataToO2O, M2MIntermediateData,
Intermediate, BooleanPKData, CharPKData, EmailPKData, FilePathPKData,
DecimalPKData, FloatPKData, IntegerPKData, IPAddressPKData,
GenericIPAddressPKData, PhonePKData, PositiveIntegerPKData,
PositiveSmallIntegerPKData, SlugPKData, SmallPKData, USStatePKData,
AutoNowDateTimeData, ModifyingSaveData, InheritAbstractModel,
ExplicitInheritBaseModel, InheritBaseModel, BigIntegerData, LengthModel,
Tag, ComplexModel)
# A set of functions that can be used to recreate
# test data objects of various kinds.

View File

@ -1,5 +1,7 @@
from __future__ import with_statement
import os
from django.conf import settings, global_settings
from django.test import TransactionTestCase, TestCase, signals
from django.test.utils import override_settings

View File

@ -1,5 +1,6 @@
from django.db import models
class Author(models.Model):
name = models.CharField(max_length=20)

View File

@ -1,7 +1,10 @@
from django.test import TestCase
from __future__ import absolute_import
from django.db import models
from regressiontests.signals_regress.models import Author, Book
from django.test import TestCase
from .models import Author, Book
signal_output = []

View File

@ -4,6 +4,7 @@ from django.core import signing
from django.http import HttpRequest, HttpResponse
from django.test import TestCase
class SignedCookieTest(TestCase):
def test_can_set_and_read_signed_cookies(self):

View File

@ -4,6 +4,7 @@ from django.core import signing
from django.test import TestCase
from django.utils.encoding import force_unicode
class TestSigner(TestCase):
def test_signature(self):

View File

@ -1,8 +1,12 @@
from __future__ import absolute_import
from django.conf import settings
from django.contrib.sites.models import Site
from django.test import TestCase
from models import SyndicatedArticle, ExclusiveArticle, CustomArticle, InvalidArticle, ConfusedArticle
from .models import (SyndicatedArticle, ExclusiveArticle, CustomArticle,
InvalidArticle, ConfusedArticle)
class SitesFrameworkTestCase(TestCase):
def setUp(self):

View File

@ -1,4 +1,5 @@
from django.db import models
class Article(models.Model):
text = models.TextField()

View File

@ -1,7 +1,7 @@
import warnings
from django.test import TestCase
from django.contrib.auth.models import User
from django.test import TestCase
class SpecialHeadersTest(TestCase):

View File

@ -1,8 +1,11 @@
# coding: utf-8
from __future__ import absolute_import
from django.conf.urls import patterns
from django.views.generic.list_detail import object_detail
from models import Article
import views
from . import views
from .models import Article
urlpatterns = patterns('',
(r'^special_headers/article/(?P<object_id>\d+)/$', object_detail, {'queryset': Article.objects.all()}),

View File

@ -1,5 +1,6 @@
# -*- encoding: utf-8 -*-
from __future__ import with_statement
import codecs
import os
import posixpath

View File

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from django.db import models
class Foo(models.Model):
name = models.CharField(max_length=50)
friend = models.CharField(max_length=50, blank=True)

Some files were not shown because too many files have changed in this diff Show More