53 else: |
53 else: |
54 x, y , z, k = new |
54 x, y , z, k = new |
55 self.assert_comment(id, x, y, z, k) |
55 self.assert_comment(id, x, y, z, k) |
56 |
56 |
57 def test_wrapper_shifted(self): |
57 def test_wrapper_shifted(self): |
58 content = """<html><body>This is a <b>test</b> text</body></html>""" |
58 content = u"""<html><body>This is a <b>test</b> text</body></html>""" |
59 new_content = """<html><body>This is a <b>te</b>e<b>est</b> text</body></html>""" |
59 new_content = u"""<html><body>This is a <b>te</b>e<b>est</b> text</body></html>""" |
60 self.preserve_comment_pos(content, new_content, [([2,2,2,4],[4,4,2,4]),]) |
60 self.preserve_comment_pos(content, new_content, [([2,2,2,4],[4,4,2,4]),]) |
61 |
61 |
62 def test_comment_removed(self): |
62 def test_comment_removed(self): |
63 content = """<html><body>This is a <b>test</b> text</body></html>""" |
63 content = u"""<html><body>This is a <b>test</b> text</body></html>""" |
64 new_content = """<html><body>This is a <b>test</b> txt</body></html>""" |
64 new_content = u"""<html><body>This is a <b>test</b> txt</body></html>""" |
65 self.preserve_comment_pos(content, new_content, [([2,2,2,4],None),]) |
65 self.preserve_comment_pos(content, new_content, [([2,2,2,4],None),]) |
66 |
66 |
67 def test_offset_shifted(self): |
67 def test_offset_shifted(self): |
68 content = """<html><body>This is a <b>test</b> text</body></html>""" |
68 content = u"""<html><body>This is a <b>test</b> text</body></html>""" |
69 new_content = """<html><body>a <b>teXXXst</b>a text</body></html>""" |
69 new_content = u"""<html><body>a <b>teXXXst</b>a text</body></html>""" |
70 self.preserve_comment_pos(content, new_content, [([2,2,2,4],[2,2,3,5]),]) |
70 self.preserve_comment_pos(content, new_content, [([2,2,2,4],[2,2,3,5]),]) |
71 |
71 |
72 def test_insert_wrapper(self): |
72 def test_insert_wrapper(self): |
73 content = """<html><body>This is a <b>test</b> text</body></html>""" |
73 content = u"""<html><body>This is a <b>test</b> text</body></html>""" |
74 new_content = """<html><body>This is a <b>test</b> te<b>x</b>t</body></html>""" |
74 new_content = u"""<html><body>This is a <b>test</b> te<b>x</b>t</body></html>""" |
75 self.preserve_comment_pos(content, new_content, [([2,2,2,5],[2,4,2,1]),]) |
75 self.preserve_comment_pos(content, new_content, [([2,2,2,5],[2,4,2,1]),]) |
76 |
76 |
77 def test_multiwrapper(self): |
77 def test_multiwrapper(self): |
78 content = """<html><body>This is a <b>test</b> text</body></html>""" |
78 content = u"""<html><body>This is a <b>test</b> text</body></html>""" |
79 new_content = """<html><body>This is a <b>testXXX<b>X</b>XXXXXXX</b>X text</body></html>""" |
79 new_content = u"""<html><body>This is a <b>testXXX<b>X</b>XXXXXXX</b>X text</body></html>""" |
80 self.preserve_comment_pos(content, new_content, [([0,2,2,4],None),]) |
80 self.preserve_comment_pos(content, new_content, [([0,2,2,4],None),]) |
81 |
81 |
82 def test_insert_wrapper(self): |
82 def test_insert_wrapper2(self): |
83 content = """<html><body>aa<b>test</b>bb</body></html>""" |
83 content = u"""<html><body>aa<b>test</b>bb</body></html>""" |
84 new_content = """<html><body>aXa<b>test</b>bXb</body></html>""" |
84 new_content = u"""<html><body>aXa<b>test</b>bXb</body></html>""" |
85 self.preserve_comment_pos(content, new_content, [([0,2,1,1],[0,2,2,1]),]) |
85 self.preserve_comment_pos(content, new_content, [([0,2,1,1],[0,2,2,1]),]) |
86 |
86 |