Esempio n. 1
0
    def test_SDL_Color_a(self):
        c1 = SDL_Color()

        def seta(color, val):
            color.a = val

        for x in range(0, 255):
            c1.a = x
            self.assertEqual(c1.a, x)

        # TODO
        # self.assertRaises(ValueError, seta,  c1, -1)
        # self.assertRaises(ValueError, seta,  c1, 256)
        self.assertRaises(TypeError, seta, c1, "Test")
        self.assertRaises(TypeError, seta, c1, None)
Esempio n. 2
0
    def test_SDL_Color_a(self):
        c1 = SDL_Color()

        def seta(color, val):
            color.a = val

        for x in range(0, 255):
            c1.a = x
            assert c1.a == x

        # TODO
        # self.assertRaises(ValueError, seta,  c1, -1)
        # self.assertRaises(ValueError, seta,  c1, 256)
        with pytest.raises(TypeError):
            seta(c1, "Test")
        with pytest.raises(TypeError):
            seta(c1, None)