Ejemplo n.º 1
0
    def test_set_color(self):
        block = Block(0, 0)
        self.assertEqual(block.color, Color.CLEAR)
        self.assertTrue(block.is_clear())

        block.set_color(Color.RED)
        self.assertEqual(block.color, Color.RED)
        self.assertFalse(block.is_clear())
Ejemplo n.º 2
0
    def test_raise_exception_on_set_color_if_invalid_color(self):
        block = Block(0, 0)

        with self.assertRaises(InvalidParameter):
            block.set_color(99999)
Ejemplo n.º 3
0
    def test_raise_exception_on_set_color_if_not_clear(self):
        block = Block(0, 0, Color.RED)

        with self.assertRaises(InvalidOperation):
            block.set_color(Color.BLUE)
Ejemplo n.º 4
0
    def test_raise_exception_on_set_color_if_invalid_color(self):
        block = Block(0, 0)

        with self.assertRaises(InvalidParameter):
            block.set_color(99999)
Ejemplo n.º 5
0
    def test_raise_exception_on_set_color_if_not_clear(self):
        block = Block(0, 0, Color.RED)

        with self.assertRaises(InvalidOperation):
            block.set_color(Color.BLUE)