Text objects are Curves, and curves usually store the material_index in .spline:
But there are no splines for Text objects, thus it's impossible to access/edit the used materials with python (or am I overlooking something?).
I stumbled upon it, 'cause I'm trying to fix some problems in the trunk addon Material Utils (Material Slot cleanup, which needs to test which material indices are actually used by an object).