def test_same_type(self): ok_(isinstance(limstr('hello world', 5), str)) ok_(isinstance(limstr(u'hello world', 5), unicode))
def test_blanks(self): eq_(limstr('', 0), '') eq_(limstr('', 1), '')
def test_normal(self): s = 'hello world' eq_(limstr(s, 0), '') eq_(limstr(s, 5), 'he...') eq_(limstr(s, 11), 'hello world') eq_(limstr(s, 12), 'hello world')
def test_negative_max_length(self): limstr('', -1)