MCPcopy
hub / github.com/Textualize/rich / test_highlight_json_with_indent

Function test_highlight_json_with_indent

tests/test_highlighter.py:170–184  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

168
169
170def test_highlight_json_with_indent():
171 json_string = json.dumps({"name": "apple", "count": 1}, indent=4)
172 text = Text(json_string)
173 highlighter = JSONHighlighter()
174 highlighter.highlight(text)
175 assert text.spans == [
176 Span(0, 1, "json.brace"),
177 Span(6, 12, "json.str"),
178 Span(14, 21, "json.str"),
179 Span(27, 34, "json.str"),
180 Span(36, 37, "json.number"),
181 Span(38, 39, "json.brace"),
182 Span(6, 12, "json.key"),
183 Span(27, 34, "json.key"),
184 ]
185
186
187def test_highlight_json_string_only():

Callers

nothing calls this directly

Calls 4

highlightMethod · 0.95
TextClass · 0.90
JSONHighlighterClass · 0.90
SpanClass · 0.90

Tested by

no test coverage detected