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