Message146961
It would be helpful to have a doctest flag that makes the test case insensitive.
Use case: nan values are printed as "nan" with typical Linux implementations, but as "NaN" on other operating systems like Solaris.
In a naive implementation, the core change to doctest.OutputChecker.check_output is:
+ if optionflags & IGNORE_CASE:
+ got = got.lower()
+ want = want.lower()
+ true_line = "true\n"
+ false_line = "false\n"
+ else:
+ true_line = "True\n"
+ false_line = "False\n"
+
# Handle the common case first, for efficiency:
# if they're string-identical, always return true.
if got == want:
return True
# The values True and False replaced 1 and 0 as the return
# value for boolean comparisons in Python 2.3.
if not (optionflags & DONT_ACCEPT_TRUE_FOR_1):
- if (got,want) == ("True\n", "1\n"):
+ if (got,want) == (true_line, "1\n"):
return True
- if (got,want) == ("False\n", "0\n"):
+ if (got,want) == (false_line, "0\n"):
return True |
|
Date |
User |
Action |
Args |
2011-11-03 19:03:20 | Gerald.Dalley | set | recipients:
+ Gerald.Dalley |
2011-11-03 19:03:20 | Gerald.Dalley | set | messageid: <1320347000.37.0.62477718357.issue13337@psf.upfronthosting.co.za> |
2011-11-03 19:03:19 | Gerald.Dalley | link | issue13337 messages |
2011-11-03 19:03:19 | Gerald.Dalley | create | |
|