[lang-ref] ( string_count_occurrence ) ( python )

def test_string_count_occurrence():
    # text.count(s)
    text = 'I have a pen.'
    assert text.count('e') == 2
    assert text.count('have') == 1