From 2fd2c18dfcf711756c5d771438c5707197b47e63 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sat, 27 Feb 2021 16:06:24 +0100 Subject: [PATCH] Remove the colour range function as it will not be used --- nw/common.py | 30 ----------------------------- tests/test_base/test_base_common.py | 30 +---------------------------- 2 files changed, 1 insertion(+), 59 deletions(-) diff --git a/nw/common.py b/nw/common.py index 6d609f6e..1cf4e9a9 100644 --- a/nw/common.py +++ b/nw/common.py @@ -150,36 +150,6 @@ def hexToInt(value, default=0): return default return default -def colRange(rgbStart, rgbEnd, nStep): - """Generate a range of colours from one RGB value to another. - """ - if len(rgbStart) != 3 and len(rgbEnd) != 3 and nStep < 1: - logger.error("Cannot create colour range from given parameters") - return None - - if nStep == 1: - return rgbStart - elif nStep == 2: - return [rgbStart, rgbEnd] - - dC = [0, 0, 0] - for c in range(3): - cA = rgbStart[c] - cB = rgbEnd[c] - dC[c] = (cB-cA)/(nStep-1) - - retCol = [rgbStart] - for n in range(nStep): - if n > 0 and n < nStep: - retCol.append([ - int(retCol[n-1][0] + dC[0]), - int(retCol[n-1][1] + dC[1]), - int(retCol[n-1][2] + dC[2]), - ]) - retCol[-1] = rgbEnd - - return retCol - def formatInt(theInt): """Formats an integer with k, M, G etc. """ diff --git a/tests/test_base/test_base_common.py b/tests/test_base/test_base_common.py index 03c408cd..695fb66a 100644 --- a/tests/test_base/test_base_common.py +++ b/tests/test_base/test_base_common.py @@ -24,7 +24,7 @@ import time import pytest from nw.common import ( - checkString, checkBool, checkInt, colRange, formatInt, transferCase, + checkString, checkBool, checkInt, formatInt, transferCase, fuzzyTime, checkHandle, formatTimeStamp, formatTime, hexToInt, makeFileNameSafe, isHandle, isTitleTag, isItemClass, isItemType, isItemLayout, numberToRoman @@ -191,34 +191,6 @@ def testBaseCommon_HexToInt(): # END Test testBaseCommon_HexToInt -@pytest.mark.base -def testBaseCommon_ColRange(): - """Test the colRange function. - """ - assert colRange([0, 0], [0, 0], 0) is None - assert cmpList( - colRange([200, 50, 0], [50, 200, 0], 1), - [200, 50, 0] - ) - assert cmpList( - colRange([200, 50, 0], [50, 200, 0], 2), - [[200, 50, 0], [50, 200, 0]] - ) - assert cmpList( - colRange([200, 50, 0], [50, 200, 0], 3), - [[200, 50, 0], [125, 125, 0], [50, 200, 0]] - ) - assert cmpList( - colRange([200, 50, 0], [50, 200, 0], 4), - [[200, 50, 0], [150, 100, 0], [100, 150, 0], [50, 200, 0]] - ) - assert cmpList( - colRange([200, 50, 0], [50, 200, 0], 5), - [[200, 50, 0], [162, 87, 0], [124, 124, 0], [86, 161, 0], [50, 200, 0]] - ) - -# END Test testBaseCommon_ColRange - @pytest.mark.base def testBaseCommon_FormatTimeStamp(): """Test the formatTimeStamp function.