Fix tests.
[naja.git] / naja / tests / test_utils.py
1 from unittest import TestCase
2
3 import pygame
4
5 from naja.utils import convert_colour, parse_bits
6 from naja.constants import BITS
7
8
9 class TestConvertColour(TestCase):
10     def setUp(self):
11         self.red = pygame.Color('red')
12
13     def test_pass_through(self):
14         self.assertEqual(self.red, convert_colour(self.red))
15
16     def test_tuple(self):
17         self.assertEqual(self.red, convert_colour((255, 0, 0)))
18
19     def test_string(self):
20         self.assertEqual(self.red, convert_colour('red'))
21
22
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]))
28         self.assertEqual(
29             parse_bits([BITS.NORTH, 'MSB']), frozenset([BITS.NORTH, BITS.MSB]))