[Python-Dev] Tests and unicode

"Martin v. Löwis" martin at v.loewis.de
Sun Oct 2 21:07:02 CEST 2005

Reinhold Birkenfeld wrote:
> One problem is that no Unicode escapes can be used since compiling
> the file raises ValueErrors for them. Such strings would have to
> be produced using unichr().

You mean, in Unicode literals? There are various approaches, depending
on context:
- you could encode the literals as UTF-8, and decode it when the
  module/test case is imported. See test_support.TESTFN_UNICODE
  for an example.
- you could use unichr
- you could use eval, see test_re for an example

> Is this the right way? Or is disabling Unicode not supported any more?

There are certainly tests that cannot be executed when Unicode is not
available. It would be good if such tests get skipped instead of being
failing, and it would be good if all tests that do not require Unicode
support run even when Unicode support is missing.

Whether "it is supported" is a tricky question: your message indicates
that, right now, it is *not* supported (or else you wouldn't have
noticed a problem). Whether we think it should be supported depends
on who "we" is, as with all these minor features: some think it is
a waste of time, some think it should be supported if reasonably
possible, and some think this a conditio sine qua non. It certainly
isn't a release-critical feature.


More information about the Python-Dev mailing list