Karen Tracey wrote: > Yeah, but the testcases are not quite that simple. They're often > testing return values from functions and as much verifying that the type > is correct as the value, so I think I'd have to change stuff like: > > >>> f.clean('1') > Decimal("1") > > to: > > >>> x = f.clean('1') > >>> print type(x), x > <class 'decimal.Decimal'> 1 > > right? >>> f.clean('1') == Decimal('1') True Since 'True' is a keyword, and Guido is *very* reluctant to even add keywords, let alone change their spelling, I think you can depend on that working indefinitely. Similarly, if you now have >>> type(a) <type 'int'> you test will fail in 3.0 which instead prints '<class 'int'>. But >>>type(a) is int True will continue working. Doctest has two quite different uses. One is to check text with interactive examples to make sure there are no mistakes in the examples. For that, printing representations is usually the natural style. Then one must accept that representations change faster that object behavior. The other use is to check code. For that, the more stilted style is more future-proof. For text doing double duty as a formal reference and code test, I would go for cross-version dependability. Terry Jan Reedy
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4