]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #27452: add line counter and crc to IDLE configHandler test dump.
authorTerry Jan Reedy <tjreedy@udel.edu>
Wed, 6 Jul 2016 00:09:53 +0000 (20:09 -0400)
committerTerry Jan Reedy <tjreedy@udel.edu>
Wed, 6 Jul 2016 00:09:53 +0000 (20:09 -0400)
Lib/idlelib/configHandler.py

index 8ac1f6097a84957d48c8e33da700abe7c53b6bd1..8954488fd6ce501631eeeb4fe8a53ff34d5d5d67 100644 (file)
@@ -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='')