Ejemplo n.º 1
0
    def test_underscore_to_readable(self):
        result = appier.underscore_to_readable("hello_world")
        self.assertEqual(type(result), str)
        self.assertEqual(result, "Hello world")

        result = appier.underscore_to_readable("hello_world", capitalize = True)
        self.assertEqual(type(result), str)
        self.assertEqual(result, "Hello World")

        result = appier.underscore_to_readable("hello_world_hello_world")
        self.assertEqual(type(result), str)
        self.assertEqual(result, "Hello world hello world")

        result = appier.underscore_to_readable("hello_world_hello_world", capitalize = True)
        self.assertEqual(type(result), str)
        self.assertEqual(result, "Hello World Hello World")
Ejemplo n.º 2
0
    def test_underscore_to_readable(self):
        result = appier.underscore_to_readable("hello_world")
        self.assertEqual(type(result), str)
        self.assertEqual(result, "Hello world")

        result = appier.underscore_to_readable("hello_world", capitalize=True)
        self.assertEqual(type(result), str)
        self.assertEqual(result, "Hello World")

        result = appier.underscore_to_readable("hello_world_hello_world")
        self.assertEqual(type(result), str)
        self.assertEqual(result, "Hello world hello world")

        result = appier.underscore_to_readable("hello_world_hello_world",
                                               capitalize=True)
        self.assertEqual(type(result), str)
        self.assertEqual(result, "Hello World Hello World")
Ejemplo n.º 3
0
    def test_underscore_to_readable(self):
        result = appier.underscore_to_readable(None)
        self.assertEqual(result, None)

        result = appier.underscore_to_readable("")
        self.assertEqual(type(result), str)
        self.assertEqual(result, "")

        result = appier.underscore_to_readable("hello_world")
        self.assertEqual(type(result), str)
        self.assertEqual(result, "Hello world")

        result = appier.underscore_to_readable("hello_world", capitalize=True)
        self.assertEqual(type(result), str)
        self.assertEqual(result, "Hello World")

        result = appier.underscore_to_readable("hello_world_hello_world")
        self.assertEqual(type(result), str)
        self.assertEqual(result, "Hello world hello world")

        result = appier.underscore_to_readable("hello_world_hello_world",
                                               capitalize=True)
        self.assertEqual(type(result), str)
        self.assertEqual(result, "Hello World Hello World")

        result = appier.underscore_to_readable("hello_world_")
        self.assertEqual(type(result), str)
        self.assertEqual(result, "Hello world")

        result = appier.underscore_to_readable("hello_world_", capitalize=True)
        self.assertEqual(type(result), str)
        self.assertEqual(result, "Hello World")

        result = appier.underscore_to_readable("__hello_world__")
        self.assertEqual(type(result), str)
        self.assertEqual(result, "Hello world")

        result = appier.underscore_to_readable("__hello_world__",
                                               capitalize=True)
        self.assertEqual(type(result), str)
        self.assertEqual(result, "Hello World")

        result = appier.underscore_to_readable("__hello___world__")
        self.assertEqual(type(result), str)
        self.assertEqual(result, "Hello world")

        result = appier.underscore_to_readable("__hello___world__",
                                               capitalize=True)
        self.assertEqual(type(result), str)
        self.assertEqual(result, "Hello World")

        result = appier.underscore_to_readable("__hello___world__",
                                               capitalize=True,
                                               separator="-")
        self.assertEqual(type(result), str)
        self.assertEqual(result, "Hello-World")
Ejemplo n.º 4
0
 def readable(self):
     return appier.underscore_to_readable(
         self.name,
         capitalize = True
     )