@classmethod<EOL><INDENT>def generate_type_methods(cls, types_and_expectations):<DEDENT>
for TypeClass, init, attrs in types_and_expectations:<EOL><INDENT>def create_test_func(TypeClass, init, attrs):<EOL><INDENT>def test_method(self):<EOL><INDENT>instance = TypeClass(**init)<EOL>for attr in attrs:<EOL><INDENT>self.assertEqual(getattr(instance, attr), attrs[attr])<EOL><DEDENT><DEDENT>test_method.__name__ = '<STR_LIT>' % TypeClass.__name__<EOL>return test_method<EOL><DEDENT>test_method = create_test_func(TypeClass, init, attrs)<EOL>setattr(cls, test_method.__name__, test_method)<EOL><DEDENT>return<EOL>
Auto generates test methods for type attribute tests