Example #1
0
 def test_pascal_case(self):
     out = StringIO()
     command = PascalCaseCommand(
         (
             ParseCaseDelimited(CharacterType.UPPERCASE),
             FormatSnakeCase(),
             FormatCamelCase(),
             FormatKebabCase(),
             FormatConstantCase(),
             FormatDomain(),
             FormatPath(),
             FormatCsv()
         ),
         out
     )
     self._execute_tests(
         'pascal_case',
         out,
         command,
         [
             'snake_case',
             'camel_case',
             'kebab_case',
             'domain',
             'path',
             'csv',
             'constant_case'
         ]
     )
Example #2
0
def main(args=None):
    args = args or argv[1:]
    Client(
        RootCommandGroup(
            (
                SnakeCaseCommand(
                    (
                        ParseCharacterDelimited(CharacterType.UNDERSCORE),
                        FormatCamelCase(),
                        FormatPascalCase(),
                        FormatKebabCase(),
                        FormatConstantCase(),
                        FormatDomain(),
                        FormatPath(),
                        FormatCsv()
                    ),
                    stdout
                ),
                CamelCaseCommand(
                    (
                        ParseCaseDelimited(CharacterType.UPPERCASE),
                        FormatSnakeCase(),
                        FormatPascalCase(),
                        FormatKebabCase(),
                        FormatConstantCase(),
                        FormatDomain(),
                        FormatPath(),
                        FormatCsv()
                    ),
                    stdout
                ),
                PascalCaseCommand(
                    (
                        ParseCaseDelimited(CharacterType.UPPERCASE),
                        FormatSnakeCase(),
                        FormatCamelCase(),
                        FormatKebabCase(),
                        FormatConstantCase(),
                        FormatDomain(),
                        FormatPath(),
                        FormatCsv()
                    ),
                    stdout
                ),
                KebabCaseCommand(
                    (
                        ParseCharacterDelimited(CharacterType.DASH),
                        FormatSnakeCase(),
                        FormatCamelCase(),
                        FormatPascalCase(),
                        FormatConstantCase(),
                        FormatDomain(),
                        FormatPath(),
                        FormatCsv()
                    ),
                    stdout
                ),
                ConstantCaseCommand(
                    (
                        ParseCharacterDelimited(CharacterType.UNDERSCORE),
                        FormatSnakeCase(),
                        FormatCamelCase(),
                        FormatPascalCase(),
                        FormatKebabCase(),
                        FormatDomain(),
                        FormatPath(),
                        FormatCsv()
                    ),
                    stdout
                ),
                PathCommand(
                    (
                        ParseCharacterDelimited(CharacterType.SLASH),
                        FormatSnakeCase(),
                        FormatCamelCase(),
                        FormatPascalCase(),
                        FormatConstantCase(),
                        FormatKebabCase(),
                        FormatDomain(),
                        FormatCsv()
                    ),
                    stdout
                ),
                DomainCommand(
                    (
                        ParseCharacterDelimited(CharacterType.DOT),
                        FormatSnakeCase(),
                        FormatCamelCase(),
                        FormatPascalCase(),
                        FormatConstantCase(),
                        FormatPath(),
                        FormatKebabCase(),
                        FormatCsv()
                    ),
                    stdout
                ),
                CsvCommand(
                    (
                        ParseCharacterDelimited(CharacterType.COMMA),
                        FormatSnakeCase(),
                        FormatCamelCase(),
                        FormatPascalCase(),
                        FormatConstantCase(),
                        FormatPath(),
                        FormatKebabCase(),
                        FormatDomain()
                    ),
                    stdout
                )
            )
        )
    ).run(args)
Example #3
0
 def test_format_constant_case(self):
     operation = FormatConstantCase()
     namespace = Namespace(format_constant_case=True, format_literals=[])
     self._execute_format_test(operation, namespace, 'constant_case')