summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2016-07-06 00:09:53 (GMT)
committerTerry Jan Reedy <tjreedy@udel.edu>2016-07-06 00:09:53 (GMT)
commit2279aeb2824a90dd1f6765f826b48b497cd89ea0 (patch)
tree116ef889e9b6f3ade046c230b1724dd7ccb17e45 /Lib
parente75ffa965ba1857038832598420ddc85e9f5ad7c (diff)
downloadcpython-2279aeb2824a90dd1f6765f826b48b497cd89ea0.zip
cpython-2279aeb2824a90dd1f6765f826b48b497cd89ea0.tar.gz
cpython-2279aeb2824a90dd1f6765f826b48b497cd89ea0.tar.bz2
Issue #27452: add line counter and crc to IDLE configHandler test dump.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/idlelib/configHandler.py31
1 files changed, 21 insertions, 10 deletions
diff --git a/Lib/idlelib/configHandler.py b/Lib/idlelib/configHandler.py
index 8ac1f60..8954488 100644
--- a/Lib/idlelib/configHandler.py
+++ b/Lib/idlelib/configHandler.py
@@ -740,21 +740,32 @@ class IdleConf:
idleConf = IdleConf()
# TODO Revise test output, write expanded unittest
-### module test
+#
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):
- print('\n', cfg, '\n')
- for key in cfg:
+ print('\n', cfg, '\n') # has variable '0xnnnnnnnn' addresses
+ for key in sorted(cfg.keys()):
sections = cfg[key].sections()
- print(key)
- print(sections)
+ sprint(key)
+ sprint(sections)
for section in sections:
options = cfg[key].options(section)
- print(section)
- print(options)
+ sprint(section)
+ sprint(options)
for option in options:
- print(option, '=', cfg[key].Get(section, option))
+ sprint(option + ' = ' + cfg[key].Get(section, option))
+
dumpCfg(idleConf.defaultCfg)
dumpCfg(idleConf.userCfg)
- print(idleConf.userCfg['main'].Get('Theme', 'name'))
- #print idleConf.userCfg['highlight'].GetDefHighlight('Foo','normal')
+ print('\nlines = ', line, ', crc = ', crc, sep='')