diff options
author | Barry Warsaw <barry@python.org> | 1998-10-15 02:18:08 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 1998-10-15 02:18:08 (GMT) |
commit | 840a84d37ab67a3b520ab49333e6f68076cf822d (patch) | |
tree | d7c5ad40f128407e257a8116485c984294363362 /Tools | |
parent | c2047c19f5afa001261cad45b0ada852450b35bb (diff) | |
download | cpython-840a84d37ab67a3b520ab49333e6f68076cf822d.zip cpython-840a84d37ab67a3b520ab49333e6f68076cf822d.tar.gz cpython-840a84d37ab67a3b520ab49333e6f68076cf822d.tar.bz2 |
Updated __main__ unit test
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/pynche/ColorDB.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Tools/pynche/ColorDB.py b/Tools/pynche/ColorDB.py index b57ad6f..863688a 100644 --- a/Tools/pynche/ColorDB.py +++ b/Tools/pynche/ColorDB.py @@ -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:])) |