Skip to content

Add test_turtledemo for colorizer in turtledemo #104428

Open
@terryjreedy

Description

@terryjreedy

A colorizer change could potentially break the use of colorizer in turtledemo.main. Relevant code:

 92 from idlelib.colorizer import ColorDelegator, color_config
 93 from idlelib.percolator import Percolator
# __init__ creates root and on line 166 calls makeTextFrame
# makeTextFrame(self, root) (line 211) makes a Frame and then a Text
213         self.text = text = Text(text_frame, ...
215         color_config(text)  
# After call to makeTextFrame() in def __init__().
195         Percolator(self.text).insertfilter(ColorDelegator())

The Percolator call can and should follow the color_config call. I propose to move the imports and those two lines to a new setup_colorizer(text) function in colorizer.py. Next add from idlelib.colorizer import setup_colorizer and setup_colorizer(text) to turtledemo. Then add a simple test of setup_colorizer to test_colorizer: create root, add Text, setup_colorizer, add some text with special items, and check that they are tagged. Branch is colordemo.

Metadata

Metadata

Assignees

Labels

stdlibPython modules in the Lib dirtestsTests in the Lib/test dirtopic-IDLE

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions