Ejemplo n.º 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'
Ejemplo n.º 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'
Ejemplo n.º 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
Ejemplo n.º 4
0
def test_truncate_at_char():
    """Ensure truncation at a particular character works."""
    original = 'asdf zxcv'
    assert truncate_string_at_char(original, ' ') == 'asdf'