Skip to content
This repository was archived by the owner on Jan 13, 2024. It is now read-only.

Commit 544c503

Browse files
author
DirectiveAthena
committed
Change: Removed rounds from Color Systems which did not need it
1 parent 8f71276 commit 544c503

File tree

5 files changed

+106
-106
lines changed

5 files changed

+106
-106
lines changed

Tests/ColorObjects/test_Dunders.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ def test_HSV(self):
9696
(bool, (), {}, (0,0,0), {}, False),
9797
(bool, (), {}, (0,0,1), {}, True),
9898
(divmod, (8,), {}, (180,.5,.5), {}, (HSV(h=22,s=0.0,v=0.0), HSV(h=4,s=0.5,v=0.5))),
99-
(divmod, ((8,.025,.02),), {}, (180,.5,.5), {}, (HSV(h=22,s=1,v=1), HSV(h=4,s=0.025,v=0.02))),
100-
(divmod, (RGB(8,4,2),), {}, (180,.5,.5), {}, (HSV(h=9,s=0.0,v=1), HSV(h=0,s=0.5,v=0.004))),
101-
(divmod, (HSV(8,.025,.02),), {}, (180,.5,.5), {}, (HSV(h=22,s=1,v=1), HSV(h=4,s=0.025,v=0.02))),
99+
(divmod, ((8,.025,.02),), {}, (180,.5,.5), {}, (HSV(h=22,s=1,v=1), HSV(h=4,s=0.024999999999999974,v=0.01999999999999999))),
100+
(divmod, (RGB(8,4,2),), {}, (180,.5,.5), {}, (HSV(h=9,s=0.0,v=1), HSV(h=0,s=0.5,v=0.0040000000000000036))),
101+
(divmod, (HSV(8,.025,.02),), {}, (180,.5,.5), {}, (HSV(h=22,s=1,v=1), HSV(h=4,s=0.024999999999999974,v=0.01999999999999999))),
102102
)
103103
self.Subtest_ObjectOperationBulk(objectType, casesOperation)
104104

@@ -113,9 +113,9 @@ def test_HSL(self):
113113
(bool, (), {}, (0,0,0), {}, False),
114114
(bool, (), {}, (0,0,1), {}, True),
115115
(divmod, (8,), {}, (180,.5,.5), {}, (HSL(h=22,s=0.0,l=0.0), HSL(h=4,s=0.5,l=0.5))),
116-
(divmod, ((8,.025,.02),), {}, (180,.5,.5), {}, (HSL(h=22,s=1,l=1), HSL(h=4,s=0.025,l=0.02))),
117-
(divmod, (RGB(8,4,2),), {}, (180,.5,.5), {}, (HSL(h=9,s=0.0,l=1), HSL(h=0,s=0.5,l=0.02))),
118-
(divmod, (HSL(8,.025,.02),), {}, (180,.5,.5), {}, (HSL(h=22,s=1,l=1), HSL(h=4,s=0.025,l=0.02))),
116+
(divmod, ((8,.025,.02),), {}, (180,.5,.5), {}, (HSL(h=22,s=1,l=1), HSL(h=4,s=0.024999999999999974,l=0.01999999999999999))),
117+
(divmod, (RGB(8,4,2),), {}, (180,.5,.5), {}, (HSL(h=9,s=0.0,l=1), HSL(h=0,s=0.5,l=0.01999999999999999))),
118+
(divmod, (HSL(8,.025,.02),), {}, (180,.5,.5), {}, (HSL(h=22,s=1,l=1), HSL(h=4,s=0.024999999999999974,l=0.01999999999999999))),
119119
)
120120
self.Subtest_ObjectOperationBulk(objectType, casesOperation)
121121

@@ -128,11 +128,11 @@ def test_CMYK(self):
128128
(round, (), {}, (.5,.5,.5,.5), {}, CMYK(0,0,0,0)),
129129
(round, (5,), {}, (.123456,.123456,.123456,.123456), {}, CMYK(.12346,.12346,.12346,.12346)),
130130
(divmod, ((8,4,2,5),), {}, (.5,.5,.5,.5), {}, (CMYK(c=0.0,m=0.0,y=0.0,k=0.0), CMYK(c=0.5,m=0.5,y=0.5,k=0.5))),
131-
(divmod, ((.8,.4,.2,.5),), {}, (.5,.5,.5,.5), {}, (CMYK(c=0.0,m=1.0,y=1,k=1.0), CMYK(c=0.5,m=0.1,y=0.1,k=0.0))),
131+
(divmod, ((.8,.4,.2,.5),), {}, (.5,.5,.5,.5), {}, (CMYK(c=0.0,m=1.0,y=1,k=1.0), CMYK(c=0.5,m=0.09999999999999998,y=0.09999999999999998,k=0.0))),
132132
(bool, (), {}, (0,0,0,0), {}, False),
133133
(bool, (), {}, (0,0,0,1), {}, True),
134134
(divmod, (8,), {}, (.5,.5,.5,.5), {}, (CMYK(c=0.0,m=0.0,y=0.0,k=0.0), CMYK(c=0.5,m=0.5,y=0.5,k=0.5))),
135-
(divmod, ((8,.025,.02, 0.01),), {}, (.5,.5,.5,.5), {}, (CMYK(c=0.0,m=1,y=1,k=1), CMYK(c=0.5,m=0.025,y=0.02,k=0.01))),
136-
(divmod, (CMYK(8,.025,.02, 0.01),), {}, (.5,.5,.5,.5), {}, (CMYK(c=0.0,m=1,y=1,k=1), CMYK(c=0.5,m=0.025,y=0.02,k=0.01))),
135+
(divmod, ((8,.025,.02, 0.01),), {}, (.5,.5,.5,.5), {}, (CMYK(c=0.0,m=1,y=1,k=1), CMYK(c=0.5,m=0.024999999999999974,y=0.01999999999999999,k=0.00999999999999999))),
136+
(divmod, (CMYK(8,.025,.02, 0.01),), {}, (.5,.5,.5,.5), {}, (CMYK(c=0.0,m=1,y=1,k=1), CMYK(c=0.5,m=0.024999999999999974,y=0.01999999999999999,k=0.00999999999999999))),
137137
)
138138
self.Subtest_ObjectOperationBulk(objectType, casesOperation)

Tests/ColorObjects/test_HSL.py

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -44,31 +44,31 @@ def test_dunder_tuples(self):
4444

4545
# math
4646
self.assertEqual(
47-
color + (.25,.25,.25),
47+
round(color + (.25,.25,.25),init.decimalPlaces),
4848
HSL(60.25,0.75,1.0)
4949
)
5050
self.assertEqual(
51-
color - (.25,.5,0.75),
51+
round(color - (.25,.5,0.75),init.decimalPlaces),
5252
HSL(59.75,0.0,0.0)
5353
)
5454
self.assertEqual(
55-
color * (.1,.5,0.75),
55+
round(color * (.1,.5,0.75),init.decimalPlaces),
5656
HSL(6.0,0.25,0.562)
5757
)
5858
self.assertEqual(
59-
color / (.1,.5,0.75),
59+
round(color / (.1,.5,0.75),init.decimalPlaces),
6060
HSL(360,1.0,1.0)
6161
)
6262
self.assertEqual(
63-
color // (.1,.5,0.75),
63+
round(color // (.1,.5,0.75),init.decimalPlaces),
6464
HSL(360,1.0,1.0)
6565
)
6666
self.assertEqual(
67-
color ** (.1,.5,0.75),
67+
round(color ** (.1,.5,0.75),init.decimalPlaces),
6868
HSL(1.506,0.707,0.806)
6969
)
7070
self.assertEqual(
71-
color % (.1,.5,0.75),
71+
round(color % (.1,.5,0.75),init.decimalPlaces),
7272
HSL(0.1, 0.0, 0.0)
7373
)
7474

@@ -85,31 +85,31 @@ def test_dunder_RGB(self):
8585

8686
# math
8787
self.assertEqual(
88-
color + RGB(32, 64, 128),
88+
round(color + RGB(32, 64, 128),init.decimalPlaces),
8989
HSL(280.0,1,1)
9090
)
9191
self.assertEqual(
92-
color - RGB(32, 64, 128),
92+
round(color - RGB(32, 64, 128),init.decimalPlaces),
9393
HSL(0,0,0.436)
9494
)
9595
self.assertEqual(
96-
color * RGB(4, 3, 2),
96+
round(color * RGB(4, 3, 2),init.decimalPlaces),
9797
HSL(360,0.167,0.009)
9898
)
9999
self.assertEqual(
100-
color / RGB(4, 3, 2),
100+
round(color / RGB(4, 3, 2),init.decimalPlaces),
101101
HSL(2.0,1,1)
102102
)
103103
self.assertEqual(
104-
color // RGB(9, 7, 5),
104+
round(color // RGB(9, 7, 5),init.decimalPlaces),
105105
HSL(2.0,1.0,1)
106106
)
107107
self.assertEqual(
108-
color ** RGB(2, 2, 1),
108+
round(color ** RGB(2, 2, 1),init.decimalPlaces),
109109
HSL(360, 0.794, 0.998)
110110
)
111111
self.assertEqual(
112-
color % RGB(9, 7, 5),
112+
round(color % RGB(9, 7, 5),init.decimalPlaces),
113113
HSL(0.0, 0.214, 0.021)
114114
)
115115

@@ -125,31 +125,31 @@ def test_dunder_HEX(self):
125125

126126
# math
127127
self.assertEqual(
128-
color + HEX("#204080"),
128+
round(color + HEX("#204080"),init.decimalPlaces),
129129
HSL(280.0, 1, 1)
130130
)
131131
self.assertEqual(
132-
color - HEX("#204080"),
132+
round(color - HEX("#204080"),init.decimalPlaces),
133133
HSL(0, 0, 0.436)
134134
)
135135
self.assertEqual(
136-
color * HEX("#040302"),
136+
round(color * HEX("#040302"),init.decimalPlaces),
137137
HSL(360, 0.167, 0.009)
138138
)
139139
self.assertEqual(
140-
color / HEX("#040302"),
140+
round(color / HEX("#040302"),init.decimalPlaces),
141141
HSL(2.0, 1, 1)
142142
)
143143
self.assertEqual(
144-
color // HEX("#090705"),
144+
round(color // HEX("#090705"),init.decimalPlaces),
145145
HSL(2.0, 1.0, 1)
146146
)
147147
self.assertEqual(
148-
color ** HEX("#020201"),
148+
round(color ** HEX("#020201"),init.decimalPlaces),
149149
HSL(360, 0.794, 0.998)
150150
)
151151
self.assertEqual(
152-
color % HEX("#090705"),
152+
round(color % HEX("#090705"),init.decimalPlaces),
153153
HSL(0.0, 0.214, 0.021)
154154
)
155155

@@ -165,31 +165,31 @@ def test_dunder_HSL(self):
165165

166166
# math
167167
self.assertEqual(
168-
color + HSL(.25,.25,.25),
168+
round(color + HSL(.25,.25,.25),init.decimalPlaces),
169169
HSL(60.25,0.75,1.0)
170170
)
171171
self.assertEqual(
172-
color - HSL(.25,.5,0.75),
172+
round(color - HSL(.25,.5,0.75),init.decimalPlaces),
173173
HSL(59.75,0.0,0.0)
174174
)
175175
self.assertEqual(
176-
color * HSL(.1,.5,0.75),
176+
round(color * HSL(.1,.5,0.75),init.decimalPlaces),
177177
HSL(6.0,0.25,0.562)
178178
)
179179
self.assertEqual(
180-
color / HSL(.1,.5,0.75),
180+
round(color / HSL(.1,.5,0.75),init.decimalPlaces),
181181
HSL(360,1.0,1.0)
182182
)
183183
self.assertEqual(
184-
color // HSL(.1,.5,0.75),
184+
round(color // HSL(.1,.5,0.75),init.decimalPlaces),
185185
HSL(360,1.0,1.0)
186186
)
187187
self.assertEqual(
188-
color ** HSL(.1,.5,0.75),
188+
round(color ** HSL(.1,.5,0.75),init.decimalPlaces),
189189
HSL(1.506,0.707,0.806)
190190
)
191191
self.assertEqual(
192-
color % HSL(.1,.5,0.75),
192+
round(color % HSL(.1,.5,0.75),init.decimalPlaces),
193193
HSL(0.1, 0.0, 0.0)
194194
)
195195

@@ -205,31 +205,31 @@ def test_dunder_HSV(self):
205205

206206
# math
207207
self.assertEqual(
208-
color + HSV(.25, .25, .25),
208+
round(color + HSV(.25, .25, .25),init.decimalPlaces),
209209
HSL(60.0,0.643,0.97)
210210
)
211211
self.assertEqual(
212-
color - HSV(.25, .5, 0.75),
212+
round(color - HSV(.25, .5, 0.75),init.decimalPlaces),
213213
HSL(60.0,0.074,0.187)
214214
)
215215
self.assertEqual(
216-
color * HSV(.1, .5, 0.75),
216+
round(color * HSV(.1, .5, 0.75),init.decimalPlaces),
217217
HSL(0.0,0.213,0.422)
218218
)
219219
self.assertEqual(
220-
color / HSV(30, .5, 0.75),
220+
round(color / HSV(30, .5, 0.75),init.decimalPlaces),
221221
HSL(2,1,1)
222222
)
223223
self.assertEqual(
224-
color // HSV(30, .5, 0.75),
224+
round(color // HSV(30, .5, 0.75),init.decimalPlaces),
225225
HSL(2.0,1.0,1.0)
226226
)
227227
self.assertEqual(
228-
color ** HSV(.1, .5, 0.75),
228+
round(color ** HSV(.1, .5, 0.75),init.decimalPlaces),
229229
HSL(1.0, 0.744, 0.85)
230230
)
231231
self.assertEqual(
232-
color % HSV(30, .5, 0.75),
232+
round(color % HSV(30, .5, 0.75),init.decimalPlaces),
233233
HSL(0,0.074,0.187)
234234
)
235235

@@ -245,30 +245,30 @@ def test_dunder_CMYK(self):
245245

246246
# math
247247
self.assertEqual(
248-
color + CMYK(.9,.9,.75,.1),
248+
round(color + CMYK(.9,.9,.75,.1),init.decimalPlaces),
249249
HSL(300.0,0.925,0.907)
250250
)
251251
self.assertEqual(
252-
color - CMYK(.9,.9,.75,.1),
252+
round(color - CMYK(.9,.9,.75,.1),init.decimalPlaces),
253253
HSL(0,0.075,0.593)
254254
)
255255
self.assertEqual(
256-
color * CMYK(.9,.9,.75,.9),
256+
round(color * CMYK(.9,.9,.75,.9),init.decimalPlaces),
257257
HSL(360,0.167,0.013)
258258
)
259259
self.assertEqual(
260-
color / CMYK(.9,.9,.75,.9),
260+
round(color / CMYK(.9,.9,.75,.9),init.decimalPlaces),
261261
HSL(0.25,1,1)
262262
)
263263
self.assertEqual(
264-
color // CMYK(.9,.9,.75,.9),
264+
round(color // CMYK(.9,.9,.75,.9),init.decimalPlaces),
265265
HSL(0.0,1.0,1)
266266
)
267267
self.assertEqual(
268-
color ** CMYK(.01,.1,.1,.2),
268+
round(color ** CMYK(.01,.1,.1,.2),init.decimalPlaces),
269269
HSL(1.0,0.904,0.804)
270270
)
271271
self.assertEqual(
272-
color % CMYK(0.75,0.25,0.25,0.15),
272+
round(color % CMYK(0.75,0.25,0.25,0.15),init.decimalPlaces),
273273
HSL(60.0,0.5,0.325)
274274
)

0 commit comments

Comments
 (0)