Skip to content

Commit c2f65f5

Browse files
committed
Minor fixes to python tests.
Signed-off-by: cuneyt.ozdas <cuneyt.ozdas@autodesk.com>
1 parent a73c230 commit c2f65f5

1 file changed

Lines changed: 29 additions & 24 deletions

File tree

tests/python/ColorSpaceTest.py

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,8 @@ def test_aliases(self):
393393
cs.addAlias('Alias2')
394394
aliases = cs.getAliases()
395395
self.assertEqual(len(aliases), 2)
396+
self.assertEqual(aliases[0], 'alias1')
397+
self.assertEqual(aliases[1], 'alias2')
396398

397399
# Name might remove an alias.
398400

@@ -644,28 +646,29 @@ def test_interop_id(self):
644646
Test the setInteropID() and getInteropID() methods.
645647
"""
646648

647-
# Test default value (should be empty)
649+
# Test default value (should be empty).
648650
self.assertEqual(self.colorspace.getInteropID(), '')
649651

650-
# Test setting and getting a simple interop ID
652+
# Test setting and getting a simple interop ID.
651653
test_id = 'lin_ap0_scene'
652654
self.colorspace.setInteropID(test_id)
653655
self.assertEqual(self.colorspace.getInteropID(), test_id)
654656

655-
# Test setting and getting a different interop ID
657+
# Test setting and getting a different interop ID.
656658
test_id2 = 'srgb_ap1_scene'
657659
self.colorspace.setInteropID(test_id2)
658660
self.assertEqual(self.colorspace.getInteropID(), test_id2)
659661

660-
# Test setting empty string
662+
# Test setting empty string.
661663
self.colorspace.setInteropID('')
662664
self.assertEqual(self.colorspace.getInteropID(), '')
663665

664-
# Test setting None (should convert to empty string)
666+
# Test setting None (should convert to empty string).
667+
self.colorspace.setInteropID('something')
665668
self.colorspace.setInteropID(None)
666669
self.assertEqual(self.colorspace.getInteropID(), '')
667670

668-
# Test wrong type (should raise TypeError)
671+
# Test wrong type (should raise TypeError).
669672
with self.assertRaises(TypeError):
670673
self.colorspace.setInteropID(123)
671674

@@ -677,40 +680,41 @@ def test_amf_transform_ids(self):
677680
Test the setAMFTransformIDs() and getAMFTransformIDs() methods.
678681
"""
679682

680-
# Test default value (should be empty)
683+
# Test default value (should be empty).
681684
self.assertEqual(self.colorspace.getAMFTransformIDs(), '')
682685

683-
# Test setting and getting a single transform ID
686+
# Test setting and getting a single transform ID.
684687
single_id = 'urn:ampas:aces:transformId:v1.5:ACEScsc.Academy.CG_to_ACES.a1.0.3'
685688
self.colorspace.setAMFTransformIDs(single_id)
686689
self.assertEqual(self.colorspace.getAMFTransformIDs(), single_id)
687690

688-
# Test setting and getting multiple transform IDs (newline-separated)
691+
# Test setting and getting multiple transform IDs (newline-separated).
689692
multiple_ids = ('urn:ampas:aces:transformId:v1.5:ACEScsc.Academy.CG_to_ACES.a1.0.3\n'
690693
'urn:ampas:aces:transformId:v1.5:ACEScsc.Academy.ACES_to_CG.a1.0.3\n'
691694
'urn:ampas:aces:transformId:v1.5:RRT.a1.0.3')
692695
self.colorspace.setAMFTransformIDs(multiple_ids)
693696
self.assertEqual(self.colorspace.getAMFTransformIDs(), multiple_ids)
694697

695-
# Test setting empty string
698+
# Test setting empty string.
696699
self.colorspace.setAMFTransformIDs('')
697700
self.assertEqual(self.colorspace.getAMFTransformIDs(), '')
698701

699-
# Test setting None (should convert to empty string)
702+
# Test setting None (should convert to empty string).
703+
self.colorspace.setAMFTransformIDs('something')
700704
self.colorspace.setAMFTransformIDs(None)
701705
self.assertEqual(self.colorspace.getAMFTransformIDs(), '')
702706

703-
# Test with different line endings
707+
# Test with different line endings.
704708
mixed_endings = 'id1\nid2\rid3\r\nid4'
705709
self.colorspace.setAMFTransformIDs(mixed_endings)
706710
self.assertEqual(self.colorspace.getAMFTransformIDs(), mixed_endings)
707711

708-
# Test with leading/trailing whitespace
712+
# Test with leading/trailing whitespace.
709713
whitespace_ids = ' \n id1 \n id2 \n '
710714
self.colorspace.setAMFTransformIDs(whitespace_ids)
711715
self.assertEqual(self.colorspace.getAMFTransformIDs(), whitespace_ids)
712716

713-
# Test wrong type (should raise TypeError)
717+
# Test wrong type (should raise TypeError).
714718
with self.assertRaises(TypeError):
715719
self.colorspace.setAMFTransformIDs(123)
716720

@@ -722,43 +726,44 @@ def test_icc_profile_name(self):
722726
Test the setICCProfileName() and getICCProfileName() methods.
723727
"""
724728

725-
# Test default value (should be empty)
729+
# Test default value (should be empty).
726730
self.assertEqual(self.colorspace.getICCProfileName(), '')
727731

728-
# Test setting and getting a simple profile name
732+
# Test setting and getting a simple profile name.
729733
profile_name = 'sRGB IEC61966-2.1'
730734
self.colorspace.setICCProfileName(profile_name)
731735
self.assertEqual(self.colorspace.getICCProfileName(), profile_name)
732736

733-
# Test setting and getting a different profile name
737+
# Test setting and getting a different profile name.
734738
profile_name2 = 'Adobe RGB (1998)'
735739
self.colorspace.setICCProfileName(profile_name2)
736740
self.assertEqual(self.colorspace.getICCProfileName(), profile_name2)
737741

738-
# Test with a more complex profile name
742+
# Test with a more complex profile name.
739743
complex_name = 'Display P3 - Apple Cinema Display (Calibrated 2023-01-15)'
740744
self.colorspace.setICCProfileName(complex_name)
741745
self.assertEqual(self.colorspace.getICCProfileName(), complex_name)
742-
743-
# Test setting empty string
746+
747+
# Test setting empty string.
744748
self.colorspace.setICCProfileName('')
745749
self.assertEqual(self.colorspace.getICCProfileName(), '')
746750

747-
# Test setting None (should convert to empty string)
751+
# Test setting None (should convert to empty string).
752+
self.colorspace.setICCProfileName('something')
748753
self.colorspace.setICCProfileName(None)
749754
self.assertEqual(self.colorspace.getICCProfileName(), '')
750755

751-
# Test with special characters and numbers
756+
# Test with special characters and numbers.
752757
special_name = 'ProPhoto RGB v2.0 (γ=1.8) [Custom Profile #123]'
753758
self.colorspace.setICCProfileName(special_name)
754759
self.assertEqual(self.colorspace.getICCProfileName(), special_name)
755760

756-
# Test with Unicode characters
761+
# Test with Unicode characters.
757762
unicode_name = 'Профиль RGB γ=2.2'
758763
self.colorspace.setICCProfileName(unicode_name)
759764
self.assertEqual(self.colorspace.getICCProfileName(), unicode_name)
760765

761-
# Test wrong type (should raise TypeError)
766+
# Test wrong type (should raise TypeError).
762767
with self.assertRaises(TypeError):
763768
self.colorspace.setICCProfileName(123)
764769

0 commit comments

Comments
 (0)