Case changes are locale-sensitive. For example, if your locale is Turkish, toUpper(“i”) is “İ”, the Turkish dotted-I. Meanwhile, toLower(“I”) is “ı”, the dotless I.
But now, if you don’t have your locale set to Turkish, then you have
toUpper(“ı”) = “I”, toLower(“I”) = “i”
so the character does not round trip.
That doesn't explain why upper lower conversion shouldn't round trip within one locale.
As an example, the Greek letter sigma has two lowercase forms, depending on whether it's at the end of a word. So 'ς'.upper().lower() == 'σ', even though all three characters are ordinary Greek letters you could even find within a single word.
adds to personal notes: Never accept a job that involves manually dealing with locales
Good note, but the fact that ς doesn't round trip isn't locale-dependent.