This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Gerald.Dalley
Recipients Gerald.Dalley
Date 2011-11-03.19:03:19
SpamBayes Score 6.8609562e-12
Marked as misclassified No
Message-id <1320347000.37.0.62477718357.issue13337@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2011-11-03 19:03:20Gerald.Dalleysetrecipients: + Gerald.Dalley
2011-11-03 19:03:20Gerald.Dalleysetmessageid: <1320347000.37.0.62477718357.issue13337@psf.upfronthosting.co.za>
2011-11-03 19:03:19Gerald.Dalleylinkissue13337 messages
2011-11-03 19:03:19Gerald.Dalleycreate