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
58f3c9dc
Kaydet (Commit)
58f3c9dc
authored
Nis 20, 2017
tarafından
Mariatta
Kaydeden (comit)
GitHub
Nis 20, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-30109: Fix reindent.py (GH-1207)
Skip the file if it has bad encoding.
üst
6dbdedb0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
test_reindent.py
Lib/test/test_tools/test_reindent.py
+7
-0
reindent.py
Tools/scripts/reindent.py
+5
-1
No files found.
Lib/test/test_tools/test_reindent.py
Dosyayı görüntüle @
58f3c9dc
...
@@ -7,6 +7,7 @@ Tools directory of a Python checkout or tarball, such as reindent.py.
...
@@ -7,6 +7,7 @@ Tools directory of a Python checkout or tarball, such as reindent.py.
import
os
import
os
import
unittest
import
unittest
from
test.support.script_helper
import
assert_python_ok
from
test.support.script_helper
import
assert_python_ok
from
test.support
import
findfile
from
test.test_tools
import
scriptsdir
,
skip_if_missing
from
test.test_tools
import
scriptsdir
,
skip_if_missing
...
@@ -23,6 +24,12 @@ class ReindentTests(unittest.TestCase):
...
@@ -23,6 +24,12 @@ class ReindentTests(unittest.TestCase):
self
.
assertEqual
(
out
,
b
''
)
self
.
assertEqual
(
out
,
b
''
)
self
.
assertGreater
(
err
,
b
''
)
self
.
assertGreater
(
err
,
b
''
)
def
test_reindent_file_with_bad_encoding
(
self
):
bad_coding_path
=
findfile
(
'bad_coding.py'
)
rc
,
out
,
err
=
assert_python_ok
(
self
.
script
,
'-r'
,
bad_coding_path
)
self
.
assertEqual
(
out
,
b
''
)
self
.
assertNotEqual
(
err
,
b
''
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
()
unittest
.
main
()
Tools/scripts/reindent.py
Dosyayı görüntüle @
58f3c9dc
...
@@ -118,7 +118,11 @@ def check(file):
...
@@ -118,7 +118,11 @@ def check(file):
if
verbose
:
if
verbose
:
print
(
"checking"
,
file
,
"..."
,
end
=
' '
)
print
(
"checking"
,
file
,
"..."
,
end
=
' '
)
with
open
(
file
,
'rb'
)
as
f
:
with
open
(
file
,
'rb'
)
as
f
:
encoding
,
_
=
tokenize
.
detect_encoding
(
f
.
readline
)
try
:
encoding
,
_
=
tokenize
.
detect_encoding
(
f
.
readline
)
except
SyntaxError
as
se
:
errprint
(
"
%
s: SyntaxError:
%
s"
%
(
file
,
str
(
se
)))
return
try
:
try
:
with
open
(
file
,
encoding
=
encoding
)
as
f
:
with
open
(
file
,
encoding
=
encoding
)
as
f
:
r
=
Reindenter
(
f
)
r
=
Reindenter
(
f
)
...
...
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