Esempio n. 1
0
def test_common_prefix():
    """Test common prefix length of two strings."""
    assert utils.common_prefix_length('abcd', 'abce') == 3
Esempio n. 2
0
def test_differ_length():
    """Test common prefix length of two strings differing in length."""
    assert utils.common_prefix_length('abcd', 'ab') == 2
Esempio n. 3
0
def test_empty_string():
    """Test common prefix length of two strings, one of them empty."""
    assert utils.common_prefix_length('abcd', '') == 0
Esempio n. 4
0
def test_no_common_prefix():
    """Test common prefix length of two strings that have no common prefix."""
    assert utils.common_prefix_length('abcd', 'cdef') == 0