Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
b1a9f277
Kaydet (Commit)
b1a9f277
authored
Tem 20, 2007
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix test_doctest: drop u prefixes; explicitly declare
encoding as latin-1 if we want it to fail.
üst
36e0a924
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
20 deletions
+14
-20
test_doctest.py
Lib/test/test_doctest.py
+12
-12
test_doctest4.txt
Lib/test/test_doctest4.txt
+2
-8
No files found.
Lib/test/test_doctest.py
Dosyayı görüntüle @
b1a9f277
...
...
@@ -1898,7 +1898,7 @@ def test_DocFileSuite():
... '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 @@ def test_DocFileSuite():
... '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 @@ def test_DocFileSuite():
... '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 @@ def test_DocFileSuite():
... 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 @@ def test_DocFileSuite():
... '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 @@ If the tests contain non-ASCII characters, the tests might fail, since
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.
"""
...
...
Lib/test/test_doctest4.txt
Dosyayı görüntüle @
b1a9f277
...
...
@@ -4,14 +4,8 @@ This file is encoded using UTF-8.
In order to get this test to pass, we have to manually specify the
encoding.
>>> u'föö'
u'f\xf6\xf6'
>>> u'bąr'
u'b\u0105r'
>>> 'föö'
'f\x
c3\xb6\xc3\xb
6'
'f\x
f6\xf
6'
>>> 'bąr'
'b\
xc4\x8
5r'
'b\
u010
5r'
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment