예제 #1
0
def test_gen_initials_firstname_suffix():
    assert sorted(
        names.gen_initials(
            lastname="King",
            firstname="Martin Luther",
            title="Dr",
            post_nominal="Jr.",
            formats=["firstnamelastname"],
        )
    ) == sorted(
        [
            "Martin L. King",
            "Dr M. Luther King",
            "Dr Martin Luther King",
            "M. Luther King",
            "Dr M. L. King",
            "Martin Luther King",
            "Dr Martin L. King",
            "M. L. King",
            "Martin L. King, Jr.",
            "Dr M. Luther King, Jr.",
            "Dr Martin Luther King, Jr.",
            "M. Luther King, Jr.",
            "Dr M. L. King, Jr.",
            "Martin Luther King, Jr.",
            "Dr Martin L. King, Jr.",
            "M. L. King, Jr.",
        ]
    )
예제 #2
0
def test_gen_initials_no_ws():
    assert sorted(
        names.gen_initials(
            lastname="King",
            firstname="Martin Luther",
            title="Dr",
            formats=["firstnamelastname"],
            no_ws=True,
        )
    ) == sorted(
        [
            "Martin L. King",
            "Dr M. Luther King",
            "Dr Martin Luther King",
            "M. Luther King",
            "Dr M. L. King",
            "Martin Luther King",
            "Dr Martin L. King",
            "M. L. King",
            "MartinL.King",
            "DrM.LutherKing",
            "DrMartinLutherKing",
            "M.LutherKing",
            "DrM.L.King",
            "MartinLutherKing",
            "DrMartinL.King",
            "M.L.King",
        ]
    )
예제 #3
0
def test_pmc_example_parts_commas_labelled():
    title, firstname, lastname, suffix = names.name_parts(
        name="Monnington, Walter Thomas, R.A."
    )
    assert sorted(
        names.gen_initials(
            lastname=lastname,
            firstname=firstname,
            title=title,
            post_nominal=suffix,
            formats=["firstnamelastname", "lastnamefirstname"],
            no_ws=True,
        )
    ) == sorted(
        [
            "Monnington, W. T.",
            "Monnington, W. T., R.A.",
            "Monnington, W. Thomas",
            "Monnington, W. Thomas, R.A.",
            "Monnington, Walter T.",
            "Monnington, Walter T., R.A.",
            "Monnington, Walter Thomas",
            "Monnington, Walter Thomas, R.A.",
            "Monnington,W.T.",
            "Monnington,W.T.,R.A.",
            "Monnington,W.Thomas",
            "Monnington,W.Thomas,R.A.",
            "Monnington,WalterT.",
            "Monnington,WalterT.,R.A.",
            "Monnington,WalterThomas",
            "Monnington,WalterThomas,R.A.",
            "W. T. Monnington",
            "W. T. Monnington, R.A.",
            "W. Thomas Monnington",
            "W. Thomas Monnington, R.A.",
            "W.T.Monnington",
            "W.T.Monnington,R.A.",
            "W.ThomasMonnington",
            "W.ThomasMonnington,R.A.",
            "Walter T. Monnington",
            "Walter T. Monnington, R.A.",
            "Walter Thomas Monnington",
            "Walter Thomas Monnington, R.A.",
            "WalterT.Monnington",
            "WalterT.Monnington,R.A.",
            "WalterThomasMonnington",
            "WalterThomasMonnington,R.A.",
        ]
    )
예제 #4
0
def test_gen_initials_lastname():
    assert sorted(
        names.gen_initials(
            lastname="King",
            firstname="Martin Luther",
            title="Dr",
            formats=["lastnamefirstname"],
        )
    ) == sorted(
        [
            "King, Martin L.",
            "King, Dr M. Luther",
            "King, Dr Martin Luther",
            "King, M. Luther",
            "King, Dr M. L.",
            "King, Martin Luther",
            "King, Dr Martin L.",
            "King, M. L.",
        ]
    )