Esempio n. 1
0
    def commands(self):
        ret = []

        try:
            commands = package_contents("%s.commands" % (self.package_name,), filter_function=lambda name: name.startswith("_"))
        except ImportError:
            return ret

        for command in commands:
            class_name = "%sCommand" % (camelize(command))
            _, cmdclass = import_object("%s.commands.%s.%s" % (self.package_name, command, class_name))
            ret.append(cmdclass())

        return ret
Esempio n. 2
0
 def test_camelize_names(self):
     self.assertEqual("Camel", camelize("camel"))
     self.assertEqual("CamelCase", camelize("camel_case"))
     self.assertEqual("CamelCaseFunctionTransformation", camelize("camel_case_function_transformation"))
     self.assertEqual("CamelCase", camelize("camel__case"))