Esempio n. 1
0
 def test_compatibility(self):
     from caselib import convert, CamelCase, camelCase, snake_case, \
                         SNAKE_CASE, hypen_case, HYPEN_CASE
     assert 'helloWorld'  == convert('HelloWorld', CamelCase, camelCase)
     assert 'hello_world' == convert('HelloWorld', CamelCase, snake_case)
     assert 'HELLO_WORLD' == convert('HelloWorld', CamelCase, SNAKE_CASE)
     assert 'HelloWorld'  == convert('helloWorld', camelCase, CamelCase)
     assert 'hello_world' == convert('helloWorld', camelCase, snake_case)
     assert 'HELLO_WORLD' == convert('helloWorld', camelCase, SNAKE_CASE)
     assert 'HelloWorld'  == convert('hello_world', snake_case, CamelCase)
     assert 'helloWorld'  == convert('hello_world', snake_case, camelCase)
     assert 'HELLO_WORLD' == convert('hello_world', snake_case, SNAKE_CASE)
     assert 'HelloWorld'  == convert('HELLO_WORLD', SNAKE_CASE, CamelCase)
     assert 'helloWorld'  == convert('HELLO_WORLD', SNAKE_CASE, camelCase)
     assert 'hello_world' == convert('HELLO_WORLD', SNAKE_CASE, snake_case)
     assert 'hello-world' == convert('HELLO_WORLD', SNAKE_CASE, hypen_case)
     assert 'hello-world' == convert('helloWorld', camelCase, hypen_case)
     assert 'HELLO-WORLD' == convert('helloWorld', camelCase, HYPEN_CASE)
Esempio n. 2
0
 def test_convert(self):
     from caselib import convert, CamelCase, camelCase, snake_case, \
                         SNAKE_CASE, hypen_case, HYPEN_CASE
     assert 'helloWorld'  == convert(CamelCase, camelCase, 'HelloWorld')
     assert 'hello_world' == convert(CamelCase, snake_case, 'HelloWorld')
     assert 'HELLO_WORLD' == convert(CamelCase, SNAKE_CASE, 'HelloWorld')
     assert 'HelloWorld'  == convert(camelCase, CamelCase, 'helloWorld')
     assert 'hello_world' == convert(camelCase, snake_case, 'helloWorld')
     assert 'HELLO_WORLD' == convert(camelCase, SNAKE_CASE, 'helloWorld')
     assert 'HelloWorld'  == convert(snake_case, CamelCase, 'hello_world')
     assert 'helloWorld'  == convert(snake_case, camelCase, 'hello_world')
     assert 'HELLO_WORLD' == convert(snake_case, SNAKE_CASE, 'hello_world')
     assert 'HelloWorld'  == convert(SNAKE_CASE, CamelCase, 'HELLO_WORLD')
     assert 'helloWorld'  == convert(SNAKE_CASE, camelCase, 'HELLO_WORLD')
     assert 'hello_world' == convert(SNAKE_CASE, snake_case, 'HELLO_WORLD')
     assert 'hello-world' == convert(SNAKE_CASE, hypen_case, 'HELLO_WORLD')
     assert 'hello-world' == convert(camelCase, hypen_case, 'helloWorld')
     assert 'HELLO-WORLD' == convert(camelCase, HYPEN_CASE, 'helloWorld')
     assert 'HelloWorld' == convert(hypen_case, CamelCase, 'hello-world')
     assert 'helloWorld' == convert(hypen_case, camelCase, 'hello-world')
     assert 'hello_world' == convert(hypen_case, snake_case, 'hello-world')