示例#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 model_class_name(self):
        """
        Generates a pascal case based class name based on the table name.

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

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

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

        return name
示例#3
0
def test_remove_special_characters():
    assert remove_special_characters("Test @#$% .. ;;") == "Test"
    assert remove_special_characters("Test @#$% ..",
                                     remove_spaces=False) == "Test  "
def test_remove_special_characters():
    assert remove_special_characters('Test @#$% .. ;;') == 'Test'
    assert remove_special_characters('Test @#$% ..', remove_spaces=False) == 'Test  '