def test_non_string_input(self): # Filters shouldn't break if passed non-strings self.assertEqual(addslashes(123), '123') self.assertEqual(linenumbers(123), '1. 123') self.assertEqual(lower(123), '123') self.assertEqual(make_list(123), ['1', '2', '3']) self.assertEqual(slugify(123), '123') self.assertEqual(title(123), '123') self.assertEqual(truncatewords(123, 2), '123') self.assertEqual(upper(123), '123') self.assertEqual(urlencode(123), '123') self.assertEqual(urlize(123), '123') self.assertEqual(urlizetrunc(123, 1), '123') self.assertEqual(wordcount(123), 1) self.assertEqual(wordwrap(123, 2), '123') self.assertEqual(ljust('123', 4), '123 ') self.assertEqual(rjust('123', 4), ' 123') self.assertEqual(center('123', 5), ' 123 ') self.assertEqual(center('123', 6), ' 123 ') self.assertEqual(cut(123, '2'), '13') self.assertEqual(escape(123), '123') self.assertEqual(linebreaks_filter(123), '<p>123</p>') self.assertEqual(linebreaksbr(123), '123') self.assertEqual(removetags(123, 'a'), '123') self.assertEqual(striptags(123), '123')
def test_rjust(self): self.assertEqual(ljust('test', 10), 'test ') self.assertEqual(ljust('test', 3), 'test') self.assertEqual(rjust('test', 10), ' test') self.assertEqual(rjust('test', 3), 'test')
def test_non_string_input(self): self.assertEqual(ljust(123, 4), '123 ')
def test_less_than_string_length(self): self.assertEqual(ljust('test', 3), 'test')
def test_less_than_string_length(self): self.assertEqual(ljust("test", 3), "test")
def test_ljust(self): self.assertEqual(ljust("test", 10), "test ") self.assertEqual(ljust("test", 3), "test")