Kaydet (Commit) 2279aeb2 authored tarafından Terry Jan Reedy's avatar Terry Jan Reedy

Issue #27452: add line counter and crc to IDLE configHandler test dump.

üst e75ffa96
...@@ -740,21 +740,32 @@ class IdleConf: ...@@ -740,21 +740,32 @@ class IdleConf:
idleConf = IdleConf() idleConf = IdleConf()
# TODO Revise test output, write expanded unittest # TODO Revise test output, write expanded unittest
### module test #
if __name__ == '__main__': if __name__ == '__main__':
from zlib import crc32
line, crc = 0, 0
def sprint(obj):
global line, crc
txt = str(obj)
line += 1
crc = crc32(txt.encode(encoding='utf-8'), crc)
print(txt)
#print('***', line, crc, '***') # uncomment for diagnosis
def dumpCfg(cfg): def dumpCfg(cfg):
print('\n', cfg, '\n') print('\n', cfg, '\n') # has variable '0xnnnnnnnn' addresses
for key in cfg: for key in sorted(cfg.keys()):
sections = cfg[key].sections() sections = cfg[key].sections()
print(key) sprint(key)
print(sections) sprint(sections)
for section in sections: for section in sections:
options = cfg[key].options(section) options = cfg[key].options(section)
print(section) sprint(section)
print(options) sprint(options)
for option in options: for option in options:
print(option, '=', cfg[key].Get(section, option)) sprint(option + ' = ' + cfg[key].Get(section, option))
dumpCfg(idleConf.defaultCfg) dumpCfg(idleConf.defaultCfg)
dumpCfg(idleConf.userCfg) dumpCfg(idleConf.userCfg)
print(idleConf.userCfg['main'].Get('Theme', 'name')) print('\nlines = ', line, ', crc = ', crc, sep='')
#print idleConf.userCfg['highlight'].GetDefHighlight('Foo','normal')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment