예제 #1
0
    def model_attribute_name(self):
        """
        Generates a pascal case based model attribute name based on the field name.

        :return: The generated model attribute name.
        :rtype: str
        """

        name = remove_special_characters(self.name, False)
        name = to_snake_case(name)

        if name[0].isnumeric():
            name = f'field_{name}'

        return name
예제 #2
0
def test_to_snake_case():
    assert to_snake_case("This is a TEST") == "this_is_a_test"
    assert to_snake_case("This  is a test") == "this_is_a_test"
def test_to_snake_case():
    assert to_snake_case('This is a TEST') == 'this_is_a_test'
    assert to_snake_case('This  is a test') == 'this_is_a_test'