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
2bc801c4
Kaydet (Commit)
2bc801c4
authored
Ara 18, 2011
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #7502: Fix equality comparison for DocTestCase instances.
Patch by Cédric Krier.
üst
cf53ae21
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
85 additions
and
0 deletions
+85
-0
doctest.py
Lib/doctest.py
+41
-0
test_doctest.py
Lib/test/test_doctest.py
+40
-0
ACKS
Misc/ACKS
+1
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/doctest.py
Dosyayı görüntüle @
2bc801c4
...
@@ -440,6 +440,21 @@ class Example:
...
@@ -440,6 +440,21 @@ class Example:
self
.
options
=
options
self
.
options
=
options
self
.
exc_msg
=
exc_msg
self
.
exc_msg
=
exc_msg
def
__eq__
(
self
,
other
):
if
type
(
self
)
is
not
type
(
other
):
return
NotImplemented
return
self
.
source
==
other
.
source
and
\
self
.
want
==
other
.
want
and
\
self
.
lineno
==
other
.
lineno
and
\
self
.
indent
==
other
.
indent
and
\
self
.
options
==
other
.
options
and
\
self
.
exc_msg
==
other
.
exc_msg
def
__ne__
(
self
,
other
):
return
not
self
==
other
class
DocTest
:
class
DocTest
:
"""
"""
A collection of doctest examples that should be run in a single
A collection of doctest examples that should be run in a single
...
@@ -488,6 +503,19 @@ class DocTest:
...
@@ -488,6 +503,19 @@ class DocTest:
return
(
'<DocTest
%
s from
%
s:
%
s (
%
s)>'
%
return
(
'<DocTest
%
s from
%
s:
%
s (
%
s)>'
%
(
self
.
name
,
self
.
filename
,
self
.
lineno
,
examples
))
(
self
.
name
,
self
.
filename
,
self
.
lineno
,
examples
))
def
__eq__
(
self
,
other
):
if
type
(
self
)
is
not
type
(
other
):
return
NotImplemented
return
self
.
examples
==
other
.
examples
and
\
self
.
docstring
==
other
.
docstring
and
\
self
.
globs
==
other
.
globs
and
\
self
.
name
==
other
.
name
and
\
self
.
filename
==
other
.
filename
and
\
self
.
lineno
==
other
.
lineno
def
__ne__
(
self
,
other
):
return
not
self
==
other
# This lets us sort tests by name:
# This lets us sort tests by name:
def
__lt__
(
self
,
other
):
def
__lt__
(
self
,
other
):
...
@@ -2204,6 +2232,19 @@ class DocTestCase(unittest.TestCase):
...
@@ -2204,6 +2232,19 @@ class DocTestCase(unittest.TestCase):
def
id
(
self
):
def
id
(
self
):
return
self
.
_dt_test
.
name
return
self
.
_dt_test
.
name
def
__eq__
(
self
,
other
):
if
type
(
self
)
is
not
type
(
other
):
return
NotImplemented
return
self
.
_dt_test
==
other
.
_dt_test
and
\
self
.
_dt_optionflags
==
other
.
_dt_optionflags
and
\
self
.
_dt_setUp
==
other
.
_dt_setUp
and
\
self
.
_dt_tearDown
==
other
.
_dt_tearDown
and
\
self
.
_dt_checker
==
other
.
_dt_checker
def
__ne__
(
self
,
other
):
return
not
self
==
other
def
__repr__
(
self
):
def
__repr__
(
self
):
name
=
self
.
_dt_test
.
name
.
split
(
'.'
)
name
=
self
.
_dt_test
.
name
.
split
(
'.'
)
return
"
%
s (
%
s)"
%
(
name
[
-
1
],
'.'
.
join
(
name
[:
-
1
]))
return
"
%
s (
%
s)"
%
(
name
[
-
1
],
'.'
.
join
(
name
[:
-
1
]))
...
...
Lib/test/test_doctest.py
Dosyayı görüntüle @
2bc801c4
...
@@ -347,6 +347,46 @@ will raise a ValueError:
...
@@ -347,6 +347,46 @@ will raise a ValueError:
Traceback (most recent call last):
Traceback (most recent call last):
ValueError: line 2 of the docstring for some_test lacks blank after ...: '...print(1)'
ValueError: line 2 of the docstring for some_test lacks blank after ...: '...print(1)'
Compare `DocTest`:
>>> docstring = '''
... >>> print 12
... 12
... '''
>>> test = parser.get_doctest(docstring, globs, 'some_test',
... 'some_test', 20)
>>> same_test = parser.get_doctest(docstring, globs, 'some_test',
... 'some_test', 20)
>>> test == same_test
True
>>> test != same_test
False
>>> docstring = '''
... >>> print 42
... 42
... '''
>>> other_test = parser.get_doctest(docstring, globs, 'other_test',
... 'other_file', 10)
>>> test == other_test
False
>>> test != other_test
True
Compare `DocTestCase`:
>>> DocTestCase = doctest.DocTestCase
>>> test_case = DocTestCase(test)
>>> same_test_case = DocTestCase(same_test)
>>> other_test_case = DocTestCase(other_test)
>>> test_case == same_test_case
True
>>> test_case != same_test_case
False
>>> test == other_test_case
False
>>> test != other_test_case
True
"""
"""
def
test_DocTestFinder
():
r"""
def
test_DocTestFinder
():
r"""
...
...
Misc/ACKS
Dosyayı görüntüle @
2bc801c4
...
@@ -509,6 +509,7 @@ Bob Kras
...
@@ -509,6 +509,7 @@ Bob Kras
Holger Krekel
Holger Krekel
Michael Kremer
Michael Kremer
Fabian Kreutz
Fabian Kreutz
Cédric Krier
Hannu Krosing
Hannu Krosing
Andrej Krpic
Andrej Krpic
Ivan Krstić
Ivan Krstić
...
...
Misc/NEWS
Dosyayı görüntüle @
2bc801c4
...
@@ -97,6 +97,9 @@ Core and Builtins
...
@@ -97,6 +97,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #7502: Fix equality comparison for DocTestCase instances. Patch by
Cédric Krier.
- Issue #8035: urllib: Fix a bug where the client could remain stuck after a
- Issue #8035: urllib: Fix a bug where the client could remain stuck after a
redirection or an error.
redirection or an error.
...
...
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