Add a bunch of tests which assert that extension types are defined nicely.
diff --git a/test/util.py b/test/util.py
index e0e25f9..d195d95 100644
--- a/test/util.py
+++ b/test/util.py
@@ -118,3 +118,22 @@
def assertFalse(self, *a, **kw):
return self.failIf(*a, **kw)
+
+
+ # Other stuff
+ def assertConsistentType(self, theType, name, *constructionArgs):
+ """
+ Perform various assertions about C{theType} to ensure that it is a
+ well-defined type. This is useful for extension types, where it's
+ pretty easy to do something wacky. If something about the type is
+ unusual, an exception will be raised.
+
+ @param theType: The type object about which to make assertions.
+ @param name: A string giving the name of the type.
+ @param constructionArgs: Positional arguments to use with C{theType} to
+ create an instance of it.
+ """
+ self.assertEqual(theType.__name__, name)
+ self.assertTrue(isinstance(theType, type))
+ instance = theType(*constructionArgs)
+ self.assertIdentical(type(instance), theType)