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
eb126edd
Unverified
Kaydet (Commit)
eb126edd
authored
Ock 30, 2018
tarafından
Benjamin Peterson
Kaydeden (comit)
GitHub
Ock 30, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
[3.6] compare with difflib not diff(1) (GH-5450) (GH-5453)
Co-authored-by:
Benjamin Peterson
<
benjamin@python.org
>
üst
a23a2c55
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
13 deletions
+9
-13
test_parser.py
Lib/lib2to3/tests/test_parser.py
+9
-13
No files found.
Lib/lib2to3/tests/test_parser.py
Dosyayı görüntüle @
eb126edd
...
@@ -12,6 +12,7 @@ from .support import driver, driver_no_print_statement
...
@@ -12,6 +12,7 @@ from .support import driver, driver_no_print_statement
from
test.support
import
verbose
from
test.support
import
verbose
# Python imports
# Python imports
import
difflib
import
importlib
import
importlib
import
operator
import
operator
import
os
import
os
...
@@ -429,8 +430,8 @@ class TestParserIdempotency(support.TestCase):
...
@@ -429,8 +430,8 @@ class TestParserIdempotency(support.TestCase):
except
ParseError
as
err
:
except
ParseError
as
err
:
self
.
fail
(
'ParseError on file
%
s (
%
s)'
%
(
filepath
,
err
))
self
.
fail
(
'ParseError on file
%
s (
%
s)'
%
(
filepath
,
err
))
new
=
str
(
tree
)
new
=
str
(
tree
)
x
=
diff
(
filepath
,
new
,
encoding
=
encoding
)
if
new
!=
source
:
if
x
:
print
(
diff_texts
(
source
,
new
,
filepath
))
self
.
fail
(
"Idempotency failed:
%
s"
%
filepath
)
self
.
fail
(
"Idempotency failed:
%
s"
%
filepath
)
def
test_extended_unpacking
(
self
):
def
test_extended_unpacking
(
self
):
...
@@ -473,14 +474,9 @@ class TestLiterals(GrammarTest):
...
@@ -473,14 +474,9 @@ class TestLiterals(GrammarTest):
self
.
validate
(
s
)
self
.
validate
(
s
)
def
diff
(
fn
,
result
,
encoding
=
'utf-8'
):
def
diff_texts
(
a
,
b
,
filename
):
try
:
a
=
a
.
splitlines
()
with
open
(
'@'
,
'w'
,
encoding
=
encoding
,
newline
=
'
\n
'
)
as
f
:
b
=
b
.
splitlines
()
f
.
write
(
str
(
result
))
return
difflib
.
unified_diff
(
a
,
b
,
filename
,
filename
,
fn
=
fn
.
replace
(
'"'
,
'
\\
"'
)
"(original)"
,
"(reserialized)"
,
return
subprocess
.
call
([
'diff'
,
'-u'
,
fn
,
'@'
],
stdout
=
(
subprocess
.
DEVNULL
if
verbose
<
1
else
None
))
lineterm
=
""
)
finally
:
try
:
os
.
remove
(
"@"
)
except
OSError
:
pass
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