def test_SDL_Color_g(self):
        c1 = SDL_Color()

        def setg(color, val):
            color.g = val

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

        # TODO
        # self.assertRaises(ValueError, setg,  c1, -1)
        # self.assertRaises(ValueError, setg,  c1, 256)
        self.assertRaises(TypeError, setg, c1, "Test")
        self.assertRaises(TypeError, setg, c1, None)
Exemple #2
0
    def test_SDL_Color_g(self):
        c1 = SDL_Color()

        def setg(color, val):
            color.g = val

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

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