]> granicus.if.org Git - python/commitdiff
Updated __main__ unit test
authorBarry Warsaw <barry@python.org>
Thu, 15 Oct 1998 02:18:08 +0000 (02:18 +0000)
committerBarry Warsaw <barry@python.org>
Thu, 15 Oct 1998 02:18:08 +0000 (02:18 +0000)
Tools/pynche/ColorDB.py

index b57ad6f2499b65f8aad0d54e899d56fe3864768a..863688a5c73c38d60e3da4c541e5cbceb3c6c558 100644 (file)
@@ -225,13 +225,18 @@ if __name__ == '__main__':
     print target, ':', red, green, blue, triplet_to_rrggbb(rgbtuple)
     name, aliases = colordb.find_byrgb(rgbtuple)
     print 'name:', name, 'aliases:', string.join(aliases, ", ")
-    target = (1, 1, 128)                         # nearest to navy
-    target = (145, 238, 144)                     # nearest to lightgreen
-    target = (255, 251, 250)                     # snow
+    r, g, b = (1, 1, 128)                        # nearest to navy
+    r, g, b = (145, 238, 144)                    # nearest to lightgreen
+    r, g, b = (255, 251, 250)                    # snow
     print 'finding nearest to', target, '...'
     import time
     t0 = time.time()
-    nearest = colordb.nearest(target)
+    nearest = colordb.nearest(r, g, b)
     t1 = time.time()
     print 'found nearest color', nearest, 'in', t1-t0, 'seconds'
-
+    # dump the database
+    for n in colordb.unique_names():
+        r, g, b = colordb.find_byname(n)
+        aliases = colordb.aliases_of(r, g, b)
+        print '%20s: (%3d/%3d/%3d) == %s' % (n, r, g, b,
+                                             string.join(aliases[1:]))