[lang-ref] ( replace_first_occurrence ) ( python )

def test_replace_first_occurrence():
    # s.replace(org, new, 1)
    text_org = 'abc def ghi\nabc def ghi'
    s_org = 'def'
    s_new  = '!!DEF!!'

    text_new = text_org.replace(s_org, s_new, 1)

    assert text_new == 'abc !!DEF!! ghi\nabc def ghi'