[SQLObject] Preventing Duplicate Class Definitions
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: Brad B. <br...@bb...> - 2004-10-01 18:32:12
|
Hi all,
So I've written a little unit test to merge a small patch from Steve
Alexander to prevent defining the same class twice. The functionality
this adds is perhaps best described by the unit test:
class ClassRegistryTest(SQLObjectTest):
def testErrorOnDuplicateClassDefinition(self):
"""Raise an error if a class is defined more than once."""
class Duplicate(SQLObject):
pass
try:
class Duplicate(SQLObject):
pass
except ValueError, err:
self.assertEqual(str(err), "class Duplicate is already in
the registry")
else:
self.fail("should have raised an error on duplicate class
definition")
It's been quite a while since I've been involved in SQLObject
development, but there are more patches on the way (I just have to
write unit tests before I check them in), so I'd like to get some
feedback from the list to ensure the time I'm spending on this and
upcoming patches is time well spent.
Comments appreciated; silence is consent. ;)
Cheers,
--
Brad Bollenbach
|