class SerializerBaseTests(unittest.TestCase):

    def setUp(self):
        # Fixture Setup
        self.serializer = Serializer()

    def test_py_convert_camel_to_snake(self):
        # Arrange
        value0 = "CamelCase"
        value1 = "camelCase"
        value2 = "camel"

        # Act
        result0 = self.serializer.py_convert_camel_to_snake(value0)
        result1 = self.serializer.py_convert_camel_to_snake(value1)
        result2 = self.serializer.py_convert_camel_to_snake(value2)

        # Assert
        self.assertEqual("CAMEL_CASE", result0)
        self.assertEqual("CAMEL_CASE", result1)
        self.assertEqual("CAMEL", result2)

    def test_py_convert_snake_to_camel(self):
        # Arrange
        value0 = "SNAKE_CASE"
        value1 = "snake_case"
        value2 = "snake"

        # Act
        result0 = self.serializer.py_convert_snake_to_camel(value0)
        result1 = self.serializer.py_convert_snake_to_camel(value1)
        result2 = self.serializer.py_convert_snake_to_camel(value2)

        # Assert
        self.assertEqual("SnakeCase", result0)
        self.assertEqual("SnakeCase", result1)
        self.assertEqual("Snake", result2)
Пример #2
0
class TestSerializerBase:
    def setup(self):
        # Fixture Setup
        self.serializer = Serializer()

    def test_py_convert_camel_to_snake(self):
        # Arrange
        value0 = "CamelCase"
        value1 = "camelCase"
        value2 = "camel"

        # Act
        result0 = self.serializer.py_convert_camel_to_snake(value0)
        result1 = self.serializer.py_convert_camel_to_snake(value1)
        result2 = self.serializer.py_convert_camel_to_snake(value2)

        # Assert
        assert result0 == "CAMEL_CASE"
        assert result1 == "CAMEL_CASE"
        assert result2 == "CAMEL"

    def test_py_convert_snake_to_camel(self):
        # Arrange
        value0 = "SNAKE_CASE"
        value1 = "snake_case"
        value2 = "snake"

        # Act
        result0 = self.serializer.py_convert_snake_to_camel(value0)
        result1 = self.serializer.py_convert_snake_to_camel(value1)
        result2 = self.serializer.py_convert_snake_to_camel(value2)

        # Assert
        assert result0 == "SnakeCase"
        assert result1 == "SnakeCase"
        assert result2 == "Snake"
Пример #3
0
class SerializerBaseTests(unittest.TestCase):
    def setUp(self):
        # Fixture Setup
        self.serializer = Serializer()

    def test_can_convert_camel_case_to_snake_case(self):
        # Arrange
        value0 = 'CamelCase'
        value1 = 'camelCase'
        value2 = 'camel'

        # Act
        result0 = self.serializer.py_convert_camel_to_snake(value0)
        result1 = self.serializer.py_convert_camel_to_snake(value1)
        result2 = self.serializer.py_convert_camel_to_snake(value2)

        # Assert
        self.assertEqual('CAMEL_CASE', result0)
        self.assertEqual('CAMEL_CASE', result1)
        self.assertEqual('CAMEL', result2)

    def test_can_convert_snake_case_to_camel_case(self):
        # Arrange
        value0 = 'SNAKE_CASE'
        value1 = 'snake_case'
        value2 = 'snake'

        # Act
        result0 = self.serializer.py_convert_snake_to_camel(value0)
        result1 = self.serializer.py_convert_snake_to_camel(value1)
        result2 = self.serializer.py_convert_snake_to_camel(value2)

        # Assert
        self.assertEqual('SnakeCase', result0)
        self.assertEqual('SnakeCase', result1)
        self.assertEqual('Snake', result2)
 def setUp(self):
     # Fixture Setup
     self.serializer = Serializer()