Skip to content
This repository was archived by the owner on Jan 13, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Tests/ColorObjects/test_ColorObjectConversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import unittest

# Custom Library
from AthenaColor.Color.ColorObjectConversion import *
from AthenaColor.Color.ColorSystem import RGB,HEX,CMYK,HSL,HSV,RGBA,HEXA
from AthenaColor import *
from AthenaColor.functions.color_object_conversion import *

# Custom Packages
# ----------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -101,7 +101,7 @@ def test_to_hsv(self):
for value, output_value in cases:
with self.subTest(value=value, output_value=output_value):
self.assertEqual(
to_HSV(value),
HSV(*(round(n, 3) for n in to_HSV(value))),
output_value
)

Expand All @@ -119,7 +119,7 @@ def test_to_hsl(self):
for value, output_value in cases:
with self.subTest(value=value, output_value=output_value):
self.assertEqual(
to_HSL(value),
HSL(*(round(n, 3) for n in to_HSL(value))),
output_value
)

Expand All @@ -137,7 +137,7 @@ def test_to_cmyk(self):
for value, output_value in cases:
with self.subTest(value=value, output_value=output_value):
self.assertEqual(
to_CMYK(value),
CMYK(*(round(n, 3) for n in to_CMYK(value))),
output_value
)

26 changes: 13 additions & 13 deletions Tests/ColorObjects/test_ColorTupleConversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import unittest

# Custom Library
from AthenaColor.Color.ColorTupleConversion import *
from AthenaColor.functions.color_tuple_conversion import *

# Custom Packages
# ----------------------------------------------------------------------------------------------------------------------
Expand All @@ -16,7 +16,7 @@ class ColorObject_TupleConversion(unittest.TestCase):
def test_NormalizeRgb(self):
for i in range(256):
with self.subTest(i=i):
NormalizeRgb(i,i,i)
normalize_rgb(i, i, i)

def test_hex_to_rgb(self):
cases = (
Expand Down Expand Up @@ -157,7 +157,7 @@ def test_rgb_to_hsv(self):
for rgb_value, hsv_value in cases:
with self.subTest(rgb_value=rgb_value, hsv_value=hsv_value):
self.assertEqual(
rgb_to_hsv(*rgb_value),
(*(round(n,3) for n in rgb_to_hsv(*rgb_value)),),
hsv_value
)

Expand All @@ -173,7 +173,7 @@ def test_hex_to_hsv(self):
for hex_value, hsv_value in cases:
with self.subTest(hex_value=hex_value, hsv_value=hsv_value):
self.assertEqual(
hex_to_hsv(hex_value),
(*(round(n,3) for n in hex_to_hsv(hex_value)),),
hsv_value
)

Expand All @@ -189,7 +189,7 @@ def test_cmyk_to_hsv(self):
for cmyk_value, hsv_value in cases:
with self.subTest(cmyk_value=cmyk_value, hsv_value=hsv_value):
self.assertEqual(
cmyk_to_hsv(*cmyk_value),
(*(round(n, 3) for n in cmyk_to_hsv(*cmyk_value)),),
hsv_value
)

Expand All @@ -205,7 +205,7 @@ def test_hsl_to_hsv(self):
for hsl_value, hsv_value in cases:
with self.subTest(hsl_value=hsl_value, hsv_value=hsv_value):
self.assertEqual(
hsl_to_hsv(*hsl_value),
(*(round(n,3) for n in hsl_to_hsv(*hsl_value)),),
hsv_value
)

Expand All @@ -221,7 +221,7 @@ def test_rgb_to_cmyk(self):
for rgb_value, cmyk_value in cases:
with self.subTest(cmyk_value=cmyk_value, rgb_value=rgb_value):
self.assertEqual(
rgb_to_cmyk(*rgb_value),
(*(round(n,3) for n in rgb_to_cmyk(*rgb_value)),),
cmyk_value
)

Expand All @@ -237,7 +237,7 @@ def test_hex_to_cmyk(self):
for hex_value, cmyk_value in cases:
with self.subTest(cmyk_value=cmyk_value, hex_value=hex_value):
self.assertEqual(
hex_to_cmyk(hex_value),
(*(round(n, 3) for n in hex_to_cmyk(hex_value)),),
cmyk_value
)

Expand All @@ -253,7 +253,7 @@ def test_hsv_to_cmyk(self):
for hsv_value, cmyk_value in cases:
with self.subTest(cmyk_value=cmyk_value, hsv_value=hsv_value):
self.assertEqual(
hsv_to_cmyk(*hsv_value),
(*(round(n,3) for n in hsv_to_cmyk(*hsv_value)),),
cmyk_value
)

Expand All @@ -269,7 +269,7 @@ def test_rgb_to_hsl(self):
for rgb_value, hsl_value in cases:
with self.subTest(rgb_value=rgb_value, hsl_value=hsl_value):
self.assertEqual(
rgb_to_hsl(*rgb_value),
(*(round(n,3) for n in rgb_to_hsl(*rgb_value)),),
hsl_value
)

Expand All @@ -285,7 +285,7 @@ def test_hex_to_hsl(self):
for hex_value, hsl_value in cases:
with self.subTest(hex_value=hex_value, hsl_value=hsl_value):
self.assertEqual(
hex_to_hsl(hex_value),
(*(round(n,3) for n in hex_to_hsl(hex_value)),),
hsl_value
)

Expand All @@ -301,7 +301,7 @@ def test_hsv_to_hsl(self):
for hsv_value, hsl_value in cases:
with self.subTest(hsl_value=hsl_value, hsv_value=hsv_value):
self.assertEqual(
hsv_to_hsl(*hsv_value),
(*(round(n,3) for n in hsv_to_hsl(*hsv_value)),),
hsl_value
)

Expand All @@ -317,7 +317,7 @@ def test_cmyk_to_hsl(self):
for cmyk_value, hsl_value in cases:
with self.subTest(cmyk_value=cmyk_value, hsl_value=hsl_value):
self.assertEqual(
cmyk_to_hsl(*cmyk_value),
(*(round(n, 3) for n in cmyk_to_hsl(*cmyk_value)),),
hsl_value
)

Expand Down
2 changes: 1 addition & 1 deletion Tests/ColorObjects/test_Dunders.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import operator

# Custom Library
from AthenaColor import RGB, RGBA, HEX, HEXA, HSL, HSV, CMYK
from AthenaColor import *

# Custom Packages
from Tests.BulkTests import BulkTests
Expand Down
84 changes: 42 additions & 42 deletions Tests/ColorObjects/test_HSL.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,31 +46,31 @@ def test_dunder_tuples(self):

# math
self.assertEqual(
round(color + (.25,.25,.25),init.decimalPlaces),
round(color + (.25,.25,.25),3),
HSL(60.25,0.75,1.0)
)
self.assertEqual(
round(color - (.25,.5,0.75),init.decimalPlaces),
round(color - (.25,.5,0.75),3),
HSL(59.75,0.0,0.0)
)
self.assertEqual(
round(color * (.1,.5,0.75),init.decimalPlaces),
round(color * (.1,.5,0.75),3),
HSL(6.0,0.25,0.562)
)
self.assertEqual(
round(color / (.1,.5,0.75),init.decimalPlaces),
round(color / (.1,.5,0.75),3),
HSL(360,1.0,1.0)
)
self.assertEqual(
round(color // (.1,.5,0.75),init.decimalPlaces),
round(color // (.1,.5,0.75),3),
HSL(360,1.0,1.0)
)
self.assertEqual(
round(color ** (.1,.5,0.75),init.decimalPlaces),
round(color ** (.1,.5,0.75),3),
HSL(1.506,0.707,0.806)
)
self.assertEqual(
round(color % (.1,.5,0.75),init.decimalPlaces),
round(color % (.1,.5,0.75),3),
HSL(0.1, 0.0, 0.0)
)

Expand All @@ -87,31 +87,31 @@ def test_dunder_RGB(self):

# math
self.assertEqual(
round(color + RGB(32, 64, 128),init.decimalPlaces),
round(color + RGB(32, 64, 128),3),
HSL(280.0,1,1)
)
self.assertEqual(
round(color - RGB(32, 64, 128),init.decimalPlaces),
round(color - RGB(32, 64, 128),3),
HSL(0,0,0.436)
)
self.assertEqual(
round(color * RGB(4, 3, 2),init.decimalPlaces),
round(color * RGB(4, 3, 2),3),
HSL(360,0.167,0.009)
)
self.assertEqual(
round(color / RGB(4, 3, 2),init.decimalPlaces),
round(color / RGB(4, 3, 2),3),
HSL(2.0,1,1)
)
self.assertEqual(
round(color // RGB(9, 7, 5),init.decimalPlaces),
round(color // RGB(9, 7, 5),3),
HSL(2.0,1.0,1)
)
self.assertEqual(
round(color ** RGB(2, 2, 1),init.decimalPlaces),
round(color ** RGB(2, 2, 1),3),
HSL(360, 0.794, 0.998)
)
self.assertEqual(
round(color % RGB(9, 7, 5),init.decimalPlaces),
round(color % RGB(9, 7, 5),3),
HSL(0.0, 0.214, 0.021)
)

Expand All @@ -127,31 +127,31 @@ def test_dunder_HEX(self):

# math
self.assertEqual(
round(color + HEX("#204080"),init.decimalPlaces),
round(color + HEX("#204080"),3),
HSL(280.0, 1, 1)
)
self.assertEqual(
round(color - HEX("#204080"),init.decimalPlaces),
round(color - HEX("#204080"),3),
HSL(0, 0, 0.436)
)
self.assertEqual(
round(color * HEX("#040302"),init.decimalPlaces),
round(color * HEX("#040302"),3),
HSL(360, 0.167, 0.009)
)
self.assertEqual(
round(color / HEX("#040302"),init.decimalPlaces),
round(color / HEX("#040302"),3),
HSL(2.0, 1, 1)
)
self.assertEqual(
round(color // HEX("#090705"),init.decimalPlaces),
round(color // HEX("#090705"),3),
HSL(2.0, 1.0, 1)
)
self.assertEqual(
round(color ** HEX("#020201"),init.decimalPlaces),
round(color ** HEX("#020201"),3),
HSL(360, 0.794, 0.998)
)
self.assertEqual(
round(color % HEX("#090705"),init.decimalPlaces),
round(color % HEX("#090705"),3),
HSL(0.0, 0.214, 0.021)
)

Expand All @@ -167,31 +167,31 @@ def test_dunder_HSL(self):

# math
self.assertEqual(
round(color + HSL(.25,.25,.25),init.decimalPlaces),
round(color + HSL(.25,.25,.25),3),
HSL(60.25,0.75,1.0)
)
self.assertEqual(
round(color - HSL(.25,.5,0.75),init.decimalPlaces),
round(color - HSL(.25,.5,0.75),3),
HSL(59.75,0.0,0.0)
)
self.assertEqual(
round(color * HSL(.1,.5,0.75),init.decimalPlaces),
round(color * HSL(.1,.5,0.75),3),
HSL(6.0,0.25,0.562)
)
self.assertEqual(
round(color / HSL(.1,.5,0.75),init.decimalPlaces),
round(color / HSL(.1,.5,0.75),3),
HSL(360,1.0,1.0)
)
self.assertEqual(
round(color // HSL(.1,.5,0.75),init.decimalPlaces),
round(color // HSL(.1,.5,0.75),3),
HSL(360,1.0,1.0)
)
self.assertEqual(
round(color ** HSL(.1,.5,0.75),init.decimalPlaces),
round(color ** HSL(.1,.5,0.75),3),
HSL(1.506,0.707,0.806)
)
self.assertEqual(
round(color % HSL(.1,.5,0.75),init.decimalPlaces),
round(color % HSL(.1,.5,0.75),3),
HSL(0.1, 0.0, 0.0)
)

Expand All @@ -207,31 +207,31 @@ def test_dunder_HSV(self):

# math
self.assertEqual(
round(color + HSV(.25, .25, .25),init.decimalPlaces),
round(color + HSV(.25, .25, .25),3),
HSL(60.0,0.643,0.97)
)
self.assertEqual(
round(color - HSV(.25, .5, 0.75),init.decimalPlaces),
round(color - HSV(.25, .5, 0.75),3),
HSL(60.0,0.074,0.187)
)
self.assertEqual(
round(color * HSV(.1, .5, 0.75),init.decimalPlaces),
round(color * HSV(.1, .5, 0.75),3),
HSL(0.0,0.213,0.422)
)
self.assertEqual(
round(color / HSV(30, .5, 0.75),init.decimalPlaces),
round(color / HSV(30, .5, 0.75),3),
HSL(2,1,1)
)
self.assertEqual(
round(color // HSV(30, .5, 0.75),init.decimalPlaces),
round(color // HSV(30, .5, 0.75),3),
HSL(2.0,1.0,1.0)
)
self.assertEqual(
round(color ** HSV(.1, .5, 0.75),init.decimalPlaces),
round(color ** HSV(.1, .5, 0.75),3),
HSL(1.0, 0.744, 0.85)
)
self.assertEqual(
round(color % HSV(30, .5, 0.75),init.decimalPlaces),
round(color % HSV(30, .5, 0.75),3),
HSL(0,0.074,0.187)
)

Expand All @@ -247,30 +247,30 @@ def test_dunder_CMYK(self):

# math
self.assertEqual(
round(color + CMYK(.9,.9,.75,.1),init.decimalPlaces),
round(color + CMYK(.9,.9,.75,.1),3),
HSL(300.0,0.925,0.907)
)
self.assertEqual(
round(color - CMYK(.9,.9,.75,.1),init.decimalPlaces),
round(color - CMYK(.9,.9,.75,.1),3),
HSL(0,0.075,0.593)
)
self.assertEqual(
round(color * CMYK(.9,.9,.75,.9),init.decimalPlaces),
round(color * CMYK(.9,.9,.75,.9),3),
HSL(360,0.167,0.013)
)
self.assertEqual(
round(color / CMYK(.9,.9,.75,.9),init.decimalPlaces),
round(color / CMYK(.9,.9,.75,.9),3),
HSL(0.25,1,1)
)
self.assertEqual(
round(color // CMYK(.9,.9,.75,.9),init.decimalPlaces),
round(color // CMYK(.9,.9,.75,.9),3),
HSL(0.0,1.0,1)
)
self.assertEqual(
round(color ** CMYK(.01,.1,.1,.2),init.decimalPlaces),
round(color ** CMYK(.01,.1,.1,.2),3),
HSL(1.0,0.904,0.804)
)
self.assertEqual(
round(color % CMYK(0.75,0.25,0.25,0.15),init.decimalPlaces),
round(color % CMYK(0.75,0.25,0.25,0.15),3),
HSL(60.0,0.5,0.325)
)
Loading