Beispiel #1
0
def test_to_underline():
    assert "abc_abc" == ColumnFormat.to_column("abcAbc",
                                               ColumnFormat.UNDERLINE)
    assert "abc_abc_id" == ColumnFormat.to_column("abcAbc",
                                                  ColumnFormat.UNDERLINE, 'id')
    assert "abc_Abc_id" == ColumnFormat.to_column("abc_Abc",
                                                  ColumnFormat.UNDERLINE, 'id')
Beispiel #2
0
def test_to_camel():
    assert "abcAbc" == ColumnFormat.to_column("abc_abc", ColumnFormat.CAMEL)
    assert "abcAbcId" == ColumnFormat.to_column("abc_abc", ColumnFormat.CAMEL,
                                                "id")
    assert "abcAbcEfg" == ColumnFormat.to_column("abc_abc_efg",
                                                 ColumnFormat.CAMEL, "")
    assert "abcAbcEfgId" == ColumnFormat.to_column("abc_abc_efg",
                                                   ColumnFormat.CAMEL, "id")
    assert "AbcAbc" == ColumnFormat.to_column("AbcAbc", ColumnFormat.CAMEL)

    assert "AbcAbcFakeId" == ColumnFormat.to_column("AbcAbc",
                                                    ColumnFormat.CAMEL,
                                                    "fake_id")
Beispiel #3
0
def test_column_object_underline():
    fmt = ColumnFormat(ColumnFormat.UNDERLINE)
    assert fmt.rename("abcABC") == "abc_aBC"
    assert fmt.rename("abcABC", "id") == "abc_aBC_id"
    assert fmt.rename("abc_aBC", "id") == "abc_a_bC_id"
Beispiel #4
0
def test_not_support():
    with pytest.raises(FrameworkNotSupport):
        ColumnFormat.to_column("test", "NotSupportFormat")
Beispiel #5
0
def test_column_object_default():
    fmt = ColumnFormat()
    assert fmt.rename("abcABC") == "abcABC"
    assert fmt.rename("abcABC", "id") == "abcABCid"
    assert fmt.rename("abc_aBC", "id") == "abc_aBCid"
Beispiel #6
0
def test_column_object_camel():
    fmt = ColumnFormat(ColumnFormat.CAMEL)
    assert fmt.rename("abcABC") == "abcABC"
    assert fmt.rename("abcABC", "id") == "abcABCId"
    assert fmt.rename("abc_aBC", "id") == "abcABCId"
Beispiel #7
0
def test_to_default():
    assert "abcAbc" == ColumnFormat.to_column("abcAbc", ColumnFormat.DEFAULT)
    assert "abcAbcid" == ColumnFormat.to_column("abcAbc", ColumnFormat.DEFAULT,
                                                'id')