コード例 #1
0
ファイル: models.py プロジェクト: code-watch/baserow
    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"
コード例 #3
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'