[Python-3000-checkins] r56468 - python/branches/py3k-struni/Lib/test/test_doctest.py python/branches/py3k-struni/Lib/test/test_doctest4.txt
Guido van Rossum
guido at python.org
Fri Jul 20 19:15:45 CEST 2007
Hi Martin,
This seems to have fixed doctest for OSX, but not for my Ubuntu
system. I wonder if there's an issue with a different default
filesystem encoding? On OSX it's 'utf-8', but on my ubuntu box it says
'ISO-8859-1'.
--Guido
On 7/20/07, martin.v.loewis <python-3000-checkins at python.org> wrote:
> Author: martin.v.loewis
> Date: Fri Jul 20 09:13:39 2007
> New Revision: 56468
>
> Modified:
> python/branches/py3k-struni/Lib/test/test_doctest.py
> python/branches/py3k-struni/Lib/test/test_doctest4.txt
> Log:
> Fix test_doctest: drop u prefixes; explicitly declare
> encoding as latin-1 if we want it to fail.
>
>
> Modified: python/branches/py3k-struni/Lib/test/test_doctest.py
> ==============================================================================
> --- python/branches/py3k-struni/Lib/test/test_doctest.py (original)
> +++ python/branches/py3k-struni/Lib/test/test_doctest.py Fri Jul 20 09:13:39 2007
> @@ -1898,7 +1898,7 @@
> ... 'test_doctest2.txt',
> ... 'test_doctest4.txt')
> >>> suite.run(unittest.TestResult())
> - <unittest.TestResult run=3 errors=0 failures=3>
> + <unittest.TestResult run=3 errors=0 failures=2>
>
> The test files are looked for in the directory containing the
> calling module. A package keyword argument can be provided to
> @@ -1910,7 +1910,7 @@
> ... 'test_doctest4.txt',
> ... package='test')
> >>> suite.run(unittest.TestResult())
> - <unittest.TestResult run=3 errors=0 failures=3>
> + <unittest.TestResult run=3 errors=0 failures=2>
>
> '/' should be used as a path separator. It will be converted
> to a native separator at run time:
> @@ -1958,7 +1958,7 @@
> ... 'test_doctest4.txt',
> ... globs={'favorite_color': 'blue'})
> >>> suite.run(unittest.TestResult())
> - <unittest.TestResult run=3 errors=0 failures=2>
> + <unittest.TestResult run=3 errors=0 failures=1>
>
> In this case, we supplied a missing favorite color. You can
> provide doctest options:
> @@ -1969,7 +1969,7 @@
> ... optionflags=doctest.DONT_ACCEPT_BLANKLINE,
> ... globs={'favorite_color': 'blue'})
> >>> suite.run(unittest.TestResult())
> - <unittest.TestResult run=3 errors=0 failures=3>
> + <unittest.TestResult run=3 errors=0 failures=2>
>
> And, you can provide setUp and tearDown functions:
>
> @@ -1990,7 +1990,7 @@
> ... 'test_doctest4.txt',
> ... setUp=setUp, tearDown=tearDown)
> >>> suite.run(unittest.TestResult())
> - <unittest.TestResult run=3 errors=0 failures=2>
> + <unittest.TestResult run=3 errors=0 failures=1>
>
> But the tearDown restores sanity:
>
> @@ -2245,26 +2245,26 @@
> it's unknown which encoding is used. The encoding can be specified
> using the optional keyword argument `encoding`:
>
> - >>> doctest.testfile('test_doctest4.txt') # doctest: +ELLIPSIS
> + >>> doctest.testfile('test_doctest4.txt', encoding='latin-1') # doctest: +ELLIPSIS
> **********************************************************************
> File "...", line 7, in test_doctest4.txt
> Failed example:
> - u'...'
> + '...'
> Expected:
> - u'f\xf6\xf6'
> + 'f\xf6\xf6'
> Got:
> - u'f\xc3\xb6\xc3\xb6'
> + 'f\xc3\xb6\xc3\xb6'
> **********************************************************************
> ...
> **********************************************************************
> 1 items had failures:
> - 2 of 4 in test_doctest4.txt
> + 2 of 2 in test_doctest4.txt
> ***Test Failed*** 2 failures.
> - (2, 4)
> + (2, 2)
> >>> doctest.master = None # Reset master.
>
> >>> doctest.testfile('test_doctest4.txt', encoding='utf-8')
> - (0, 4)
> + (0, 2)
> >>> doctest.master = None # Reset master.
> """
>
>
> Modified: python/branches/py3k-struni/Lib/test/test_doctest4.txt
> ==============================================================================
> Binary files. No diff available.
> _______________________________________________
> Python-3000-checkins mailing list
> Python-3000-checkins at python.org
> http://mail.python.org/mailman/listinfo/python-3000-checkins
>
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-3000-checkins
mailing list