Exemplo n.º 1
0
 def test_add_text_with_groups(self):
     txt = "TEXT  TAIL1  TAIL2"
     result = encode_whitespaces(txt)
     self.assertEqual(result[0], "TEXT ")
     self.assertEqual(result[2], "TAIL1 ")
     self.assertEqual(result[4], "TAIL2")
     self.assertEqual(decode_whitespaces(result), txt)
Exemplo n.º 2
0
 def test_add_text_with_brk(self):
     txt = "TEXT\nTAIL"
     result = encode_whitespaces(txt)
     self.assertEqual(result[0], "TEXT")
     self.assertEqual(result[1].TAG, CN('text:line-break'))
     self.assertEqual(result[2], "TAIL")
     self.assertEqual(decode_whitespaces(result), txt)
Exemplo n.º 3
0
 def test_add_text_with_tab(self):
     txt = "TEXT\tTAIL"
     result = encode_whitespaces(txt)
     self.assertEqual(result[0], "TEXT")
     self.assertEqual(result[1].TAG, CN('text:tab'))
     self.assertEqual(result[2], "TAIL")
     self.assertEqual(decode_whitespaces(result), txt)
Exemplo n.º 4
0
 def test_add_text_with_brk(self):
     txt = "TEXT\nTAIL"
     result = encode_whitespaces(txt)
     self.assertEqual(result[0], "TEXT")
     self.assertEqual(result[1].TAG, CN('text:line-break'))
     self.assertEqual(result[2], "TAIL")
     self.assertEqual(decode_whitespaces(result), txt)
Exemplo n.º 5
0
 def test_add_text_ends_with_5_spc(self):
     txt = "TEXT     "
     result = encode_whitespaces(txt)
     self.assertEqual(result[0], "TEXT ")
     self.assertEqual(result[1].TAG, CN('text:s'))
     self.assertEqual(result[1].count, 4)
     self.assertEqual(decode_whitespaces(result), txt)
Exemplo n.º 6
0
 def test_add_text_with_tab(self):
     txt = "TEXT\tTAIL"
     result = encode_whitespaces(txt)
     self.assertEqual(result[0], "TEXT")
     self.assertEqual(result[1].TAG, CN('text:tab'))
     self.assertEqual(result[2], "TAIL")
     self.assertEqual(decode_whitespaces(result), txt)
Exemplo n.º 7
0
 def test_add_text_with_groups(self):
     txt = "TEXT  TAIL1  TAIL2"
     result = encode_whitespaces(txt)
     self.assertEqual(result[0], "TEXT ")
     self.assertEqual(result[2], "TAIL1 ")
     self.assertEqual(result[4], "TAIL2")
     self.assertEqual(decode_whitespaces(result), txt)
Exemplo n.º 8
0
 def test_add_text_ends_with_5_spc(self):
     txt = "TEXT     "
     result = encode_whitespaces(txt)
     self.assertEqual(result[0], "TEXT ")
     self.assertEqual(result[1].TAG, CN('text:s'))
     self.assertEqual(result[1].count, 4)
     self.assertEqual(decode_whitespaces(result), txt)
Exemplo n.º 9
0
 def test_add_text_start_with_spc_tab(self):
     txt = "  \tTEXT"
     result = encode_whitespaces(txt)
     self.assertEqual(result[0], " ")
     self.assertEqual(result[1].TAG, CN('text:s'))
     self.assertEqual(result[2].TAG, CN('text:tab'))
     self.assertEqual(result[3], "TEXT")
     self.assertEqual(decode_whitespaces(result), txt)
Exemplo n.º 10
0
 def test_add_text_start_with_spc_tab(self):
     txt = "  \tTEXT"
     result = encode_whitespaces(txt)
     self.assertEqual(result[0], " ")
     self.assertEqual(result[1].TAG, CN('text:s'))
     self.assertEqual(result[2].TAG, CN('text:tab'))
     self.assertEqual(result[3], "TEXT")
     self.assertEqual(decode_whitespaces(result), txt)
Exemplo n.º 11
0
 def test_add_text_with_brk_after_spc(self):
     txt = "TEXT\nTAIL     \n"
     result = encode_whitespaces(txt)
     self.assertEqual(result[0], "TEXT")
     self.assertEqual(result[1].TAG, CN('text:line-break'))
     self.assertEqual(result[2], "TAIL ")
     self.assertEqual(result[3].TAG, CN('text:s'))
     self.assertEqual(result[3].count, 4)
     self.assertEqual(result[4].TAG, CN('text:line-break'))
     self.assertEqual(decode_whitespaces(result), txt)
Exemplo n.º 12
0
 def test_add_text_with_brk_after_spc(self):
     txt = "TEXT\nTAIL     \n"
     result = encode_whitespaces(txt)
     self.assertEqual(result[0], "TEXT")
     self.assertEqual(result[1].TAG, CN('text:line-break'))
     self.assertEqual(result[2], "TAIL ")
     self.assertEqual(result[3].TAG, CN('text:s'))
     self.assertEqual(result[3].count, 4)
     self.assertEqual(result[4].TAG, CN('text:line-break'))
     self.assertEqual(decode_whitespaces(result), txt)
Exemplo n.º 13
0
 def test_add_text_with_1_spc(self):
     txt = "TEXT TAIL"
     result = encode_whitespaces(txt)
     self.assertEqual(result[0], txt)
     self.assertEqual(decode_whitespaces(result), txt)
Exemplo n.º 14
0
 def test_add_simple_text(self):
     result = encode_whitespaces("TEXT")
     self.assertEqual(result[0], "TEXT")
     self.assertEqual(decode_whitespaces(result), "TEXT")
Exemplo n.º 15
0
 def test_add_text_with_1_spc(self):
     txt = "TEXT TAIL"
     result = encode_whitespaces(txt)
     self.assertEqual(result[0], txt)
     self.assertEqual(decode_whitespaces(result), txt)
Exemplo n.º 16
0
 def test_add_simple_text(self):
     result = encode_whitespaces("TEXT")
     self.assertEqual(result[0], "TEXT")
     self.assertEqual(decode_whitespaces(result), "TEXT")