MCPcopy Index your code
hub / github.com/python/cpython / test_find_comment

Method test_find_comment

Lib/idlelib/idle_test/test_format.py:71–123  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

69 text.delete('1.0', 'end')
70
71 def test_find_comment(self):
72 comment = (
73 "# Comment block with no blank lines before\n"
74 "# Comment line\n"
75 "\n")
76 self.runcase(comment, 3, ('1.0', '3.0', '#', comment[0:58]))
77
78 comment = (
79 "\n"
80 "# Comment block with whitespace line before and after\n"
81 "# Comment line\n"
82 "\n")
83 self.runcase(comment, 4, ('2.0', '4.0', '#', comment[1:70]))
84
85 comment = (
86 "\n"
87 " # Indented comment block with whitespace before and after\n"
88 " # Comment line\n"
89 "\n")
90 self.runcase(comment, 4, ('2.0', '4.0', ' #', comment[1:82]))
91
92 comment = (
93 "\n"
94 "# Single line comment\n"
95 "\n")
96 self.runcase(comment, 3, ('2.0', '3.0', '#', comment[1:23]))
97
98 comment = (
99 "\n"
100 " # Single line comment with leading whitespace\n"
101 "\n")
102 self.runcase(comment, 3, ('2.0', '3.0', ' #', comment[1:51]))
103
104 comment = (
105 "\n"
106 "# Comment immediately followed by code\n"
107 "x = 42\n"
108 "\n")
109 self.runcase(comment, 3, ('2.0', '3.0', '#', comment[1:40]))
110
111 comment = (
112 "\n"
113 " # Indented comment immediately followed by code\n"
114 "x = 42\n"
115 "\n")
116 self.runcase(comment, 3, ('2.0', '3.0', ' #', comment[1:53]))
117
118 comment = (
119 "\n"
120 "# Comment immediately followed by indented code\n"
121 " x = 42\n"
122 "\n")
123 self.runcase(comment, 3, ('2.0', '3.0', '#', comment[1:49]))
124
125 def test_find_paragraph(self):
126 teststring = (

Callers

nothing calls this directly

Calls 1

runcaseMethod · 0.95

Tested by

no test coverage detected