#15285 closed (fixed)
Example in Topic/Testing refer to django.utils.unittest
| Reported by: | Owned by: | Gabriel Hurley | |
|---|---|---|---|
| Component: | Documentation | Version: | 1.2 |
| Severity: | Keywords: | testing | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
I'm reading http://docs.djangoproject.com/en/1.2/topics/testing/ and there's example:-
from django.utils import unittest
from myapp.models import Animal
class AnimalTestCase(unittest.TestCase):
def setUp(self):
self.lion = Animal.objects.create(name="lion", sound="roar")
self.cat = Animal.objects.create(name="cat", sound="meow")
def testSpeaking(self):
self.assertEqual(self.lion.speak(), 'The lion says "roar"')
self.assertEqual(self.cat.speak(), 'The cat says "meow"')
And this is how I installed Django:-
$ mkvirtualenv testdjango $ pip install Django==1.2 $ python >>> import django >>> django.get_version() '1.2' >>> import django.utils.unittest Traceback (most recent call last): File "<console>", line 1, in <module> ImportError: No module named unittest >>> from django.utils import unittest Traceback (most recent call last): File "<console>", line 1, in <module> ImportError: cannot import name unittest
Got the same result with "pip install Django==1.2.4"
Change History (4)
comment:1 by , 15 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:2 by , 15 years ago
| milestone: | → 1.3 |
|---|---|
| Owner: | changed from to |
| Status: | new → assigned |
Yep, that was backported from trunk [15228], and didn't get edited for 1.2.X. It's an easy fix.
Note:
See TracTickets
for help on using tickets.
This is an error in the docs.