Remove a handful of `import *` from the tests.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16973 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
406f9d1fa0
commit
43920cd32e
|
@ -4,16 +4,17 @@
|
||||||
Strings can be used instead of model literals to set up "lazy" relations.
|
Strings can be used instead of model literals to set up "lazy" relations.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.db.models import *
|
from django.db import models
|
||||||
|
|
||||||
class Parent(Model):
|
|
||||||
name = CharField(max_length=100)
|
class Parent(models.Model):
|
||||||
|
name = models.CharField(max_length=100)
|
||||||
|
|
||||||
# Use a simple string for forward declarations.
|
# Use a simple string for forward declarations.
|
||||||
bestchild = ForeignKey("Child", null=True, related_name="favoured_by")
|
bestchild = models.ForeignKey("Child", null=True, related_name="favoured_by")
|
||||||
|
|
||||||
class Child(Model):
|
class Child(models.Model):
|
||||||
name = CharField(max_length=100)
|
name = models.CharField(max_length=100)
|
||||||
|
|
||||||
# You can also explicitally specify the related app.
|
# You can also explicitally specify the related app.
|
||||||
parent = ForeignKey("mutually_referential.Parent")
|
parent = models.ForeignKey("mutually_referential.Parent")
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from django.conf.urls.defaults import *
|
from django.conf.urls import patterns, include
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
(r'^admin/', include(admin.site.urls)),
|
(r'^admin/', include(admin.site.urls)),
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from django.dispatch.saferef import *
|
from django.dispatch.saferef import safeRef
|
||||||
|
|
||||||
from django.utils import unittest
|
from django.utils import unittest
|
||||||
|
|
||||||
|
|
||||||
class Test1(object):
|
class Test1(object):
|
||||||
def x(self):
|
def x(self):
|
||||||
pass
|
pass
|
||||||
|
@ -32,21 +32,21 @@ class Tester(unittest.TestCase):
|
||||||
self.ts = ts
|
self.ts = ts
|
||||||
self.ss = ss
|
self.ss = ss
|
||||||
self.closureCount = 0
|
self.closureCount = 0
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
del self.ts
|
del self.ts
|
||||||
del self.ss
|
del self.ss
|
||||||
|
|
||||||
def testIn(self):
|
def testIn(self):
|
||||||
"""Test the "in" operator for safe references (cmp)"""
|
"""Test the "in" operator for safe references (cmp)"""
|
||||||
for t in self.ts[:50]:
|
for t in self.ts[:50]:
|
||||||
self.assertTrue(safeRef(t.x) in self.ss)
|
self.assertTrue(safeRef(t.x) in self.ss)
|
||||||
|
|
||||||
def testValid(self):
|
def testValid(self):
|
||||||
"""Test that the references are valid (return instance methods)"""
|
"""Test that the references are valid (return instance methods)"""
|
||||||
for s in self.ss:
|
for s in self.ss:
|
||||||
self.assertTrue(s())
|
self.assertTrue(s())
|
||||||
|
|
||||||
def testShortCircuit (self):
|
def testShortCircuit (self):
|
||||||
"""Test that creation short-circuits to reuse existing references"""
|
"""Test that creation short-circuits to reuse existing references"""
|
||||||
sd = {}
|
sd = {}
|
||||||
|
@ -59,15 +59,15 @@ class Tester(unittest.TestCase):
|
||||||
else:
|
else:
|
||||||
self.assertTrue(sd.has_key(safeRef(t)))
|
self.assertTrue(sd.has_key(safeRef(t)))
|
||||||
self.assertTrue(safeRef(t) in sd)
|
self.assertTrue(safeRef(t) in sd)
|
||||||
|
|
||||||
def testRepresentation (self):
|
def testRepresentation (self):
|
||||||
"""Test that the reference object's representation works
|
"""Test that the reference object's representation works
|
||||||
|
|
||||||
XXX Doesn't currently check the results, just that no error
|
XXX Doesn't currently check the results, just that no error
|
||||||
is raised
|
is raised
|
||||||
"""
|
"""
|
||||||
repr(self.ss[-1])
|
repr(self.ss[-1])
|
||||||
|
|
||||||
def _closure(self, ref):
|
def _closure(self, ref):
|
||||||
"""Dumb utility mechanism to increment deletion counter"""
|
"""Dumb utility mechanism to increment deletion counter"""
|
||||||
self.closureCount +=1
|
self.closureCount +=1
|
||||||
|
|
|
@ -4,8 +4,10 @@ from django.forms import *
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
from django.utils import unittest
|
from django.utils import unittest
|
||||||
|
|
||||||
from regressiontests.forms.tests.fields import verify_exists_urls
|
from regressiontests.forms.tests.fields import verify_exists_urls
|
||||||
|
|
||||||
|
|
||||||
class AssertFormErrorsMixin(object):
|
class AssertFormErrorsMixin(object):
|
||||||
def assertFormErrors(self, expected, the_callable, *args, **kwargs):
|
def assertFormErrors(self, expected, the_callable, *args, **kwargs):
|
||||||
try:
|
try:
|
||||||
|
@ -14,7 +16,6 @@ class AssertFormErrorsMixin(object):
|
||||||
except ValidationError, e:
|
except ValidationError, e:
|
||||||
self.assertEqual(e.messages, expected)
|
self.assertEqual(e.messages, expected)
|
||||||
|
|
||||||
|
|
||||||
class FormsErrorMessagesTestCase(unittest.TestCase, AssertFormErrorsMixin):
|
class FormsErrorMessagesTestCase(unittest.TestCase, AssertFormErrorsMixin):
|
||||||
def test_charfield(self):
|
def test_charfield(self):
|
||||||
e = {
|
e = {
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from __future__ import with_statement
|
from __future__ import with_statement
|
||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
from django.utils.text import *
|
from django.test import TestCase
|
||||||
from django.utils.http import urlquote, urlquote_plus, cookie_date, http_date
|
|
||||||
from django.utils.encoding import iri_to_uri
|
from django.utils.encoding import iri_to_uri
|
||||||
|
from django.utils.http import urlquote, urlquote_plus, cookie_date, http_date
|
||||||
|
from django.utils.text import get_text_list, smart_split
|
||||||
from django.utils.translation import override
|
from django.utils.translation import override
|
||||||
|
|
||||||
|
|
||||||
class TextTests(TestCase):
|
class TextTests(TestCase):
|
||||||
"""
|
"""
|
||||||
Tests for stuff in django.utils.text and other text munging util functions.
|
Tests for stuff in django.utils.text and other text munging util functions.
|
||||||
|
|
|
@ -6,7 +6,8 @@ import copy
|
||||||
import pickle
|
import pickle
|
||||||
|
|
||||||
from django.test import SimpleTestCase
|
from django.test import SimpleTestCase
|
||||||
from django.utils.datastructures import *
|
from django.utils.datastructures import (DictWrapper, DotExpandedDict,
|
||||||
|
ImmutableList, MultiValueDict, MultiValueDictKeyError, MergeDict, SortedDict)
|
||||||
|
|
||||||
|
|
||||||
class SortedDictTests(SimpleTestCase):
|
class SortedDictTests(SimpleTestCase):
|
||||||
|
|
Loading…
Reference in New Issue