diff options
author | Barry Warsaw <barry@python.org> | 1998-09-25 22:51:36 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 1998-09-25 22:51:36 (GMT) |
commit | a5a018fbd49b29da3726905388e68c2e56b49cfd (patch) | |
tree | ae48bd49ff3cc45c808804d6903d85daceafdf24 | |
parent | 9195f55bbfdd615f479a9880a90824adfacd102b (diff) | |
download | cpython-a5a018fbd49b29da3726905388e68c2e56b49cfd.zip cpython-a5a018fbd49b29da3726905388e68c2e56b49cfd.tar.gz cpython-a5a018fbd49b29da3726905388e68c2e56b49cfd.tar.bz2 |
Fixed unit test
-rw-r--r-- | Tools/pynche/ColorDB.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Tools/pynche/ColorDB.py b/Tools/pynche/ColorDB.py index c8e1d6b..fae0a3b 100644 --- a/Tools/pynche/ColorDB.py +++ b/Tools/pynche/ColorDB.py @@ -24,6 +24,7 @@ class BadColor(Exception): DEFAULT_DB = None + # generic class class ColorDB: @@ -169,7 +170,7 @@ def triplet_to_rrggbb(rgbtuple): _maxtuple = (256.0,) * 3 -def triplet_to_pmwrgb(rgbtuple): +def triplet_to_fractional_rgb(rgbtuple): return map(operator.__div__, rgbtuple, _maxtuple) @@ -183,10 +184,9 @@ if __name__ == '__main__': sys.exit(1) # on my system, this color matches exactly target = 'navy' - target = 'snow' - red, green, blue = colordb.find_byname(target) - print target, ':', red, green, blue, hex(rrggbb) - name, aliases = colordb.find_byrgb((red, green, blue)) + red, green, blue = rgbtuple = colordb.find_byname(target) + 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 @@ -194,7 +194,7 @@ if __name__ == '__main__': print 'finding nearest to', target, '...' import time t0 = time.time() - nearest = apply(colordb.nearest, target) + nearest = colordb.nearest(target) t1 = time.time() print 'found nearest color', nearest, 'in', t1-t0, 'seconds' |