Permalink
Browse files

Add a simple repr for the BaseRegistry subclasses

  • Loading branch information...
1 parent b00ba38 commit 5ec9107148e24be2588aed27600206f97e9c3745 @d0ugal d0ugal committed Dec 7, 2011
Showing with 9 additions and 0 deletions.
  1. +3 −0 appregister/base.py
  2. +6 −0 tests/test_appregister/tests.py
View
@@ -117,6 +117,9 @@ def clear(self):
"""
self.setup()
+ def __repr__(self):
+ return '<%s: %s members>' % (self.__class__.__name__, len(self))
+
class Registry(BaseRegistry):
"""
@@ -131,6 +131,12 @@ class MyQuestion(Question):
registry.clear()
self.assertNotIn(MyQuestion, registry.all())
+ def test_repr(self):
+
+ from test_appregister.models import registry
+
+ self.assertEqual(repr(registry), '<QuestionRegistry: 0 members>')
+
class NamedRegistryTestCase(unittest.TestCase):

0 comments on commit 5ec9107

Please sign in to comment.