1 from unittest import TestCase
5 from naja.utils import convert_colour, parse_bits
6 from naja.constants import BITS
9 class TestConvertColour(TestCase):
11 self.red = pygame.Color('red')
13 def test_pass_through(self):
14 self.assertEqual(self.red, convert_colour(self.red))
17 self.assertEqual(self.red, convert_colour((255, 0, 0)))
19 def test_string(self):
20 self.assertEqual(self.red, convert_colour('red'))
23 class TestParseBits(TestCase):
24 def test_parse_bits(self):
25 self.assertEqual(parse_bits([]), frozenset([]))
26 self.assertEqual(parse_bits(['RED']), frozenset([BITS.RED]))
27 self.assertEqual(parse_bits([BITS.BLUE]), frozenset([BITS.BLUE]))
29 parse_bits([BITS.NORTH, 'MSB']), frozenset([BITS.NORTH, BITS.MSB]))