Index: tests/regressiontests/m2m_regress/models.py
===================================================================
--- tests/regressiontests/m2m_regress/models.py	(revision 14201)
+++ tests/regressiontests/m2m_regress/models.py	(working copy)
@@ -56,70 +56,3 @@
 class User(models.Model):
     name = models.CharField(max_length=30)
     friends = models.ManyToManyField(auth.User)
-
-__test__ = {"regressions": """
-# Multiple m2m references to the same model or a different model must be
-# distinguished when accessing the relations through an instance attribute.
-
->>> s1 = SelfRefer.objects.create(name='s1')
->>> s2 = SelfRefer.objects.create(name='s2')
->>> s3 = SelfRefer.objects.create(name='s3')
->>> s1.references.add(s2)
->>> s1.related.add(s3)
-
->>> e1 = Entry.objects.create(name='e1')
->>> t1 = Tag.objects.create(name='t1')
->>> t2 = Tag.objects.create(name='t2')
->>> e1.topics.add(t1)
->>> e1.related.add(t2)
-
->>> s1.references.all()
-[<SelfRefer: s2>]
->>> s1.related.all()
-[<SelfRefer: s3>]
-
->>> e1.topics.all()
-[<Tag: t1>]
->>> e1.related.all()
-[<Tag: t2>]
-
-# The secret internal related names for self-referential many-to-many fields
-# shouldn't appear in the list when an error is made.
->>> SelfRefer.objects.filter(porcupine='fred')
-Traceback (most recent call last):
-...
-FieldError: Cannot resolve keyword 'porcupine' into field. Choices are: id, name, references, related, selfreferchild, selfreferchildsibling
-
-# Test to ensure that the relationship between two inherited models
-# with a self-referential m2m field maintains symmetry
->>> sr_child = SelfReferChild(name="Hanna")
->>> sr_child.save()
-
->>> sr_sibling = SelfReferChildSibling(name="Beth")
->>> sr_sibling.save()
->>> sr_child.related.add(sr_sibling)
->>> sr_child.related.all()
-[<SelfRefer: Beth>]
->>> sr_sibling.related.all()
-[<SelfRefer: Hanna>]
-
-# Regression for #11311 - The primary key for models in a m2m relation
-# doesn't have to be an AutoField
->>> w = Worksheet(id='abc')
->>> w.save()
->>> w.delete()
-
-# Regression for #11956 -- You can add an object to a m2m with the
-# base class without causing integrity errors
->>> c1 = TagCollection.objects.create(name='c1')
->>> c1.tags = [t1,t2]
-
->>> c1 = TagCollection.objects.get(name='c1')
->>> c1.tags.all()
-[<Tag: t1>, <Tag: t2>]
-
->>> t1.tag_collections.all()
-[<TagCollection: c1>]
-
-"""
-}
Index: tests/regressiontests/m2m_regress/tests.py
===================================================================
--- tests/regressiontests/m2m_regress/tests.py	(revision 0)
+++ tests/regressiontests/m2m_regress/tests.py	(revision 0)
@@ -0,0 +1,74 @@
+from django.core.exceptions import FieldError
+from django.test import TestCase
+
+from models import SelfRefer, Tag, TagCollection, Entry, SelfReferChild, \
+                    SelfReferChildSibling, Worksheet
+
+class M2MRegressionTests(TestCase):
+    def test_multiple_m2m(self):
+        # Multiple m2m references to model must be distinguished when
+        # accessing the relations through an instance attribute.
+        
+        s1 = SelfRefer.objects.create(name='s1')
+        s2 = SelfRefer.objects.create(name='s2')
+        s3 = SelfRefer.objects.create(name='s3')
+        s1.references.add(s2)
+        s1.related.add(s3)
+        
+        e1 = Entry.objects.create(name='e1')
+        t1 = Tag.objects.create(name='t1')
+        t2 = Tag.objects.create(name='t2')
+        
+        e1.topics.add(t1)
+        e1.related.add(t2)
+        
+        self.assertQuerysetEqual(s1.references.all(), ["<SelfRefer: s2>"])
+        self.assertQuerysetEqual(s1.related.all(), ["<SelfRefer: s3>"])
+        
+        self.assertQuerysetEqual(e1.topics.all(), ["<Tag: t1>"])
+        self.assertQuerysetEqual(e1.related.all(), ["<Tag: t2>"])
+        
+    def test_internal_related_name_not_in_error_msg(self):
+        # The secret internal related names for self-referential many-to-many
+        # fields shouldn't appear in the list when an error is made.
+        
+        try:
+            SelfRefer.objects.filter(porcupine='fred')
+        except FieldError, e:
+            self.assertEqual(unicode(e), u"Cannot resolve keyword 'porcupine' into field. Choices are: id, name, references, related, selfreferchild, selfreferchildsibling")
+        
+    def test_m2m_inheritance_symmetry(self):
+        # Test to ensure that the relationship between two inherited models
+        # with a self-referential m2m field maintains symmetry
+        
+        sr_child = SelfReferChild(name="Hanna")
+        sr_child.save()
+        
+        sr_sibling = SelfReferChildSibling(name="Beth")
+        sr_sibling.save()
+        sr_child.related.add(sr_sibling)
+        
+        self.assertQuerysetEqual(sr_child.related.all(), ["<SelfRefer: Beth>"])
+        self.assertQuerysetEqual(sr_sibling.related.all(), ["<SelfRefer: Hanna>"])
+    
+    def test_m2m_pk_field_type(self):
+        # Regression for #11311 - The primary key for models in a m2m relation
+        # doesn't have to be an AutoField
+        
+        w = Worksheet(id='abc')
+        w.save()
+        w.delete()
+    
+    def test_add_m2m_with_base_class(self):
+        # Regression for #11956 -- You can add an object to a m2m with the
+        # base class without causing integrity errors
+        
+        t1 = Tag.objects.create(name='t1')
+        t2 = Tag.objects.create(name='t2')
+        
+        c1 = TagCollection.objects.create(name='c1')
+        c1.tags = [t1,t2]
+        c1 = TagCollection.objects.get(name='c1')
+        
+        self.assertQuerysetEqual(c1.tags.all(), ["<Tag: t1>", "<Tag: t2>"])
+        self.assertQuerysetEqual(t1.tag_collections.all(), ["<TagCollection: c1>"])
