Skip to content

Commit

Permalink
Possibly fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasWilshaw committed Sep 30, 2024
1 parent d67c286 commit 71140a4
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/Colourimetry.py → tcolour/Colourimetry.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from enum import Enum
import TransferCharacteristic as TC
from . import TransferCharacteristic as TC

class RGBPrimaries():
"""Defines a set of three RGB primaries using the CIE xy coordinate system."""
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions lib/tcolour.py → tcolour/tcolour.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import yaml
import Colourimetry
import TransferCharacteristic
from . import Colourimetry
from . import TransferCharacteristic
import uritools

class TColor():
Expand Down Expand Up @@ -149,7 +149,7 @@ def add_colour_space(self, colour_space):
def print_colourimetry(self, descriptor):
"""Pretty prints the colourimetry data set for the given descriptor"""

item:Colourimetry = config.config[descriptor]
item:Colourimetry = self.config[descriptor]
print("-", item.descriptor)
print("\tRGB Primaries: " + item.primaries.__str__())
print("\tAchromatic Centroid: ", item.achromatic)
Expand Down
6 changes: 4 additions & 2 deletions tests/context.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..\\tcolour')))
import tcolour.tcolour as tc
#print(sys.path)

sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import tcolour
8 changes: 4 additions & 4 deletions tests/test_Colourimetry.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import unittest
import sys
from .context import tc
from tcolour import Colourimetry
from tcolour import TransferCharacteristic as TC

class TestColourimetry(unittest.TestCase):
def test_valid(self):
col = tc.Colourimetry.Colourimetry()
col = Colourimetry.Colourimetry()
# Should be invalid as nothing is set
self.assertFalse(col.colourspace_valid())

Expand All @@ -18,5 +18,5 @@ def test_valid(self):
# Should be invalid as still missing TC
self.assertFalse(col.colourspace_valid())

col.transfer_characteristic = tc.TransferCharacteristic.TransferCharacteristicPower(parameters={'a': 2.2})
col.transfer_characteristic = TC.TransferCharacteristicPower(parameters={'a': 2.2})
self.assertTrue(col.colourspace_valid())

0 comments on commit 71140a4

Please sign in to comment.