예제 #1
0
def test_truncate_at_multiple_chars():
    """Ensure truncation with multiple characters uses the rightmost one."""
    original = 'as-df=zx_cv'
    assert truncate_string_at_char(original, '-=') == 'as-df'
예제 #2
0
def test_truncate_at_last_char():
    """Ensure truncation happens at the last occurrence of the character."""
    original = 'as df zx cv'
    assert truncate_string_at_char(original, ' ') == 'as df zx'
예제 #3
0
def test_truncate_at_nonexistent_char():
    """Ensure truncation-at-character doesn't apply if char isn't present."""
    original = 'asdfzxcv'
    assert truncate_string_at_char(original, ' ') == original
예제 #4
0
def test_truncate_at_char():
    """Ensure truncation at a particular character works."""
    original = 'asdf zxcv'
    assert truncate_string_at_char(original, ' ') == 'asdf'