def test_smart_truncate_new_suffix(self): """Test smart_truncate utility function with a defined suffix """ s = """Cosby sweater iphone artisan, squid trust fund photo booth twee shoreditch single-origin coffee aesthetic jean shorts messenger bag brooklyn butcher. Iphone fap banksy next level put a bird on it, letterpress photo booth thundercats biodiesel fanny pack.""" trunc = smart_truncate(content=s, suffix='...MORE') self.assertTrue(trunc.endswith('...MORE'), s)
def test_smart_truncate_long(self): """Test smart_truncate utility function with a long string """ s = """Cosby sweater iphone artisan, squid trust fund photo booth twee shoreditch single-origin coffee aesthetic jean shorts messenger bag brooklyn butcher. Iphone fap banksy next level put a bird on it, letterpress photo booth thundercats biodiesel fanny pack.""" trunc = smart_truncate(s) self.assertTrue(trunc.endswith('(more)'), s)
def test_smart_truncate_short(self): """Test smart_truncate utility function with a short string """ s = 'Quinoa cred brooklyn, sartorial letterpress.' trunc = smart_truncate(s) self.assertTrue(trunc.endswith('letterpress.'))