Standard file handles are another thing you should not assume are there (though I'm not sure how to test for it programmatically).
We once had a user that, for whatever reason, tweaked their Unix installations to not pass an open stderr to processes - they just got stdin and stdout (that is, file handles 0 and 1, but not 2). If you wrote to stderr anywhere in your program, it wrote to whatever was open on handle 2, which was not a stderr that the OS passed in.
Yeah, that's a pretty insane thing to do, but somebody was doing it...