Hi Malcolm,
> I would like to see if subProject.parent the first time you test it
> (your first assert()) is exactly the same as after the subProject.save()
> line.
>
I did a bit of debugging and uncovered the following facts. I think
they explain the goings on pretty clearly.
Let us take the s
On Mon, 2007-02-26 at 17:19 +, Manoj Govindan wrote:
> Hi Malcolm,
> After reading your post, I added a couple of assertions.
> 1) Check for subProject.parent immediately after creating the
> subProject object.
> 2) Compare id()s of project and subProject.parent *after saving*
> subProject.
>
Hi Malcolm,
After reading your post, I added a couple of assertions.
1) Check for subProject.parent immediately after creating the
subProject object.
2) Compare id()s of project and subProject.parent *after saving*
subProject.
The test now looks like this:
class ProjectTests(unittest.TestCase):
On Sat, 2007-02-24 at 18:41 +, Manoj Govindan wrote:
> Hi,
> Consider a model and a simple test for the model.
>
> class Project(models.Model):
> name = models.CharField(maxlength = 255)
> parent = models.ForeignKey('self', null = True)
>
> class ProjectTests(unittest.TestCase):
>
Hi,
Consider a model and a simple test for the model.
class Project(models.Model):
name = models.CharField(maxlength = 255)
parent = models.ForeignKey('self', null = True)
class ProjectTests(unittest.TestCase):
def testCreateProjectAndSubProject(self):
project = Project(name
5 matches
Mail list logo