def test_write_read_f(self):
        expected = RGBA(r=244, g=123, b=33, a=99)

        io_stream = io.BytesIO()
        expected.write_f(io_stream)
        io_stream = io.BytesIO(io_stream.getvalue())

        self.assertEqual(expected, RGBA.read_f(io_stream))
    def read(io_stream):
        result = ShaderMaterialProperty(type=read_long(io_stream),
                                        num_chars=read_long(io_stream),
                                        name=read_string(io_stream))

        if result.type == 1:
            read_long(io_stream)  # num available chars
            result.value = read_string(io_stream)
        elif result.type == 2:
            result.value = read_float(io_stream)
        elif result.type == 4:
            result.value = read_vector(io_stream)
        elif result.type == 5:
            result.value = RGBA.read_f(io_stream)
        elif result.type == 6:
            result.value = read_long(io_stream)
        elif result.type == 7:
            result.value = read_ubyte(io_stream)
        return result