예제 #1
0
def test_specialchars():
    result = wordwrap(u'!"§$%&/()=?#+* ~öäü', 10)
    assert_equal(result, u'!"§$%&/()=?#+*\n~öäü')
예제 #2
0
def test_length_none():
    assert_raises(ValueError, lambda: wordwrap('test', None))
예제 #3
0
def test_endwithblanks():
    result = wordwrap('word          ', 10)
    assert_equal(result, 'word')
예제 #4
0
def test_blanks():
    result = wordwrap('                    ', 10)
    assert_equal(result, '')
예제 #5
0
 def do_it():
     return wordwrap(None, 10)
예제 #6
0
def test_three_lines():
    result = wordwrap("eins zwei drei vier fuenf", 10)
    assert_equal(result, "eins zwei\ndrei vier\nfuenf")
예제 #7
0
def test_two_long_words():
    result = wordwrap('einganzlangeswort undnocheinesdazu', 10)
    assert_equal(result, 'einganzlangeswort\nundnocheinesdazu')
예제 #8
0
 def test_uma_palavra_muito_maior_que_tamanho_linha(self):
     self.assertEqual(wordwrap("abobora", 2), "ab\nob\nor\na")
예제 #9
0
 def test_uma_frase_que_quebra_antes_do_espaco(self):
     self.assertEqual(wordwrap("abobora legal", 7), "abobora\nlegal")
예제 #10
0
	def test_frase_vazia_nao_quebra_linha(self):
		self.assertEqual(wordwrap("", 80), "")
예제 #11
0
	def test_uma_palavra_menor_que_tamanho_linha(self):
		self.assertEqual(wordwrap("abobora", 80), "abobora")
예제 #12
0
	def test_uma_frase_que_comeca_com_espaco(self):
		self.assertEqual(wordwrap(" abobora legal", 8), " abobora\nlegal")
예제 #13
0
	def test_uma_frase_que_quebra_apos_do_espaco(self):	
		self.assertEqual(wordwrap("abobora legal", 9), "abobora\nlegal")
		self.assertEqual(wordwrap("limao legal", 9), "limao\nlegal")
		self.assertEqual(wordwrap("limao legal", 10), "limao\nlegal")
예제 #14
0
	def test_uma_frase_que_quebra_exatamente_no_espaco(self):
		self.assertEqual(wordwrap("abobora legal", 8), "abobora\nlegal")
예제 #15
0
	def test_uma_frase_que_quebra_antes_do_espaco(self):		
		self.assertEqual(wordwrap("abobora legal", 7), "abobora\nlegal")
예제 #16
0
 def test_uma_frase_que_quebra_exatamente_no_espaco(self):
     self.assertEqual(wordwrap("abobora legal", 8), "abobora\nlegal")
예제 #17
0
def test_threewords():
    result = wordwrap("eins zwei drei", 10)
    assert_equal(result, "eins zwei\ndrei")
예제 #18
0
 def test_uma_frase_que_quebra_apos_do_espaco(self):
     self.assertEqual(wordwrap("abobora legal", 9), "abobora\nlegal")
     self.assertEqual(wordwrap("limao legal", 9), "limao\nlegal")
     self.assertEqual(wordwrap("limao legal", 10), "limao\nlegal")
예제 #19
0
def test_ten_chars():
    result = wordwrap('0123456789', 10)
    assert_equal(result, '0123456789')
예제 #20
0
 def test_uma_frase_que_comeca_com_espaco(self):
     self.assertEqual(wordwrap(" abobora legal", 8), " abobora\nlegal")
예제 #21
0
def test_single_chars():
    result = wordwrap('a b c d e f g h i j k', 10)
    assert_equal(result, 'a b c d e\nf g h i j\nk')
예제 #22
0
 def test_frase_vazia_nao_quebra_linha(self):
     self.assertEqual(wordwrap("", 80), "")
예제 #23
0
def test_text_none():
    assert_raises(ValueError, lambda: wordwrap(None, 10))
예제 #24
0
 def test_uma_palavra_menor_que_tamanho_linha(self):
     self.assertEqual(wordwrap("abobora", 80), "abobora")
예제 #25
0
def test_negative():
    assert_raises(ValueError, lambda: wordwrap('test', -5))
예제 #26
0
def test_shortword():
    result = wordwrap('einwort', 10)
    assert_equal(result, 'einwort')
예제 #27
0
def test_many_words():
    result = wordwrap('eins zwei drei view fuenf sechs sieben acht neun', 10)
    assert_equal(result, 'eins zwei\ndrei view\nfuenf\nsechs\nsieben\nacht neun')
예제 #28
0
def test_longword():
    result = wordwrap('einganzlangeswort', 10)
    assert_equal(result, 'einganzlangeswort')
예제 #29
0
def test_empty():
    result = wordwrap('', 10)
    assert_equal(result, '')
예제 #30
0
def test_twowords():
    result = wordwrap('zwei woerter', 10)
    assert_equal(result, 'zwei\nwoerter')
예제 #31
0
def test_breaks():
    result = wordwrap('Ein Satz.\nUnd noch ein zweiter Satz.\nEnde.', 15)
    assert_equal(result, 'Ein Satz.\nUnd noch ein\nzweiter Satz.\nEnde.')
예제 #32
0
	def test_uma_palavra_muito_maior_que_tamanho_linha(self):
		self.assertEqual(wordwrap("abobora", 2), "ab\nob\nor\na")