diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2006-06-04 00:23:51 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2006-06-04 00:23:51 +0000 |
| commit | a5b7c298164e3c1547988c734d6155c17f57b1d7 (patch) | |
| tree | ea42bc0b63aaf2db9600fa2546b98807bdee4f90 /tests/modeltests/m2m_recursive | |
| parent | 55e453a09c071cd34962d5b809121aa17241aaae (diff) | |
Changed all model unit tests to use __str__() instead of __repr__(). Also slightly changed related-object DoesNotExist exception message to use repr instead of str
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3075 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/modeltests/m2m_recursive')
| -rw-r--r-- | tests/modeltests/m2m_recursive/models.py | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/tests/modeltests/m2m_recursive/models.py b/tests/modeltests/m2m_recursive/models.py index 877a41fd14..c109b9cc2c 100644 --- a/tests/modeltests/m2m_recursive/models.py +++ b/tests/modeltests/m2m_recursive/models.py @@ -19,7 +19,7 @@ class Person(models.Model): friends = models.ManyToManyField('self') idols = models.ManyToManyField('self', symmetrical=False, related_name='stalkers') - def __repr__(self): + def __str__(self): return self.name API_TESTS = """ @@ -41,37 +41,37 @@ API_TESTS = """ # Who is friends with Anne? >>> a.friends.all() -[Bill, Chuck, David] +[<Person: Bill>, <Person: Chuck>, <Person: David>] # Who is friends with Bill? >>> b.friends.all() -[Anne] +[<Person: Anne>] # Who is friends with Chuck? >>> c.friends.all() -[Anne, David] +[<Person: Anne>, <Person: David>] # Who is friends with David? >>> d.friends.all() -[Anne, Chuck] +[<Person: Anne>, <Person: Chuck>] # Bill is already friends with Anne - add Anne again, but in the reverse direction >>> b.friends.add(a) # Who is friends with Anne? >>> a.friends.all() -[Bill, Chuck, David] +[<Person: Bill>, <Person: Chuck>, <Person: David>] # Who is friends with Bill? >>> b.friends.all() -[Anne] +[<Person: Anne>] # Remove Anne from Bill's friends >>> b.friends.remove(a) # Who is friends with Anne? >>> a.friends.all() -[Chuck, David] +[<Person: Chuck>, <Person: David>] # Who is friends with Bill? >>> b.friends.all() @@ -87,11 +87,11 @@ API_TESTS = """ # Reverse relationships should also be gone # Who is friends with Chuck? >>> c.friends.all() -[David] +[<Person: David>] # Who is friends with David? >>> d.friends.all() -[Chuck] +[<Person: Chuck>] # Add some idols in the direction of field definition @@ -106,27 +106,27 @@ API_TESTS = """ # Who are Anne's idols? >>> a.idols.all() -[Bill, Chuck, David] +[<Person: Bill>, <Person: Chuck>, <Person: David>] # Who is stalking Anne? >>> a.stalkers.all() -[Bill] +[<Person: Bill>] # Who are Bill's idols? >>> b.idols.all() -[Anne] +[<Person: Anne>] # Who is stalking Bill? >>> b.stalkers.all() -[Anne] +[<Person: Anne>] # Who are Chuck's idols? >>> c.idols.all() -[David] +[<Person: David>] # Who is stalking Chuck? >>> c.stalkers.all() -[Anne] +[<Person: Anne>] # Who are David's idols? >>> d.idols.all() @@ -134,40 +134,40 @@ API_TESTS = """ # Who is stalking David >>> d.stalkers.all() -[Anne, Chuck] +[<Person: Anne>, <Person: Chuck>] # Bill is already being stalked by Anne - add Anne again, but in the reverse direction >>> b.stalkers.add(a) # Who are Anne's idols? >>> a.idols.all() -[Bill, Chuck, David] +[<Person: Bill>, <Person: Chuck>, <Person: David>] # Who is stalking Anne? -[Bill] +[<Person: Bill>] # Who are Bill's idols >>> b.idols.all() -[Anne] +[<Person: Anne>] # Who is stalking Bill? >>> b.stalkers.all() -[Anne] +[<Person: Anne>] # Remove Anne from Bill's list of stalkers >>> b.stalkers.remove(a) # Who are Anne's idols? >>> a.idols.all() -[Chuck, David] +[<Person: Chuck>, <Person: David>] # Who is stalking Anne? >>> a.stalkers.all() -[Bill] +[<Person: Bill>] # Who are Bill's idols? >>> b.idols.all() -[Anne] +[<Person: Anne>] # Who is stalking Bill? >>> b.stalkers.all() @@ -187,6 +187,6 @@ API_TESTS = """ # Who is friends with David? >>> d.stalkers.all() -[Chuck] +[<Person: Chuck>] """ |
