Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
A
add-trailing-comma
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
add-trailing-comma
Commits
acf12e77
Kaydet (Commit)
acf12e77
authored
Tem 10, 2017
tarafından
Anthony Sottile
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
pypy has
https://bugs.python.org/issue16806
fixed!
üst
a662c5d4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
6 deletions
+18
-6
add_trailing_comma.py
add_trailing_comma.py
+1
-1
add_trailing_comma_test.py
tests/add_trailing_comma_test.py
+17
-5
No files found.
add_trailing_comma.py
Dosyayı görüntüle @
acf12e77
...
@@ -76,7 +76,7 @@ class FindCalls(ast.NodeVisitor):
...
@@ -76,7 +76,7 @@ class FindCalls(ast.NodeVisitor):
offset
=
_to_offset
(
argnode
)
offset
=
_to_offset
(
argnode
)
# multiline strings have invalid position, ignore them
# multiline strings have invalid position, ignore them
if
offset
.
utf8_byte_offset
!=
-
1
:
if
offset
.
utf8_byte_offset
!=
-
1
:
# pragma: no branch (cpy bug)
if
offset
.
line
>
orig
:
if
offset
.
line
>
orig
:
is_multiline
=
True
is_multiline
=
True
arg_offsets
.
add
(
offset
)
arg_offsets
.
add
(
offset
)
...
...
tests/add_trailing_comma_test.py
Dosyayı görüntüle @
acf12e77
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
from
__future__
import
absolute_import
from
__future__
import
absolute_import
from
__future__
import
unicode_literals
from
__future__
import
unicode_literals
import
ast
import
sys
import
sys
import
pytest
import
pytest
...
@@ -38,11 +39,6 @@ from add_trailing_comma import main
...
@@ -38,11 +39,6 @@ from add_trailing_comma import main
'x((
\n
'
'x((
\n
'
' 1,
\n
'
' 1,
\n
'
'))'
,
'))'
,
# Can't handle multi line strings
'x(
\n
'
' """
\n
'
' """
\n
'
')'
,
),
),
)
)
def
test_fix_calls_noops
(
src
):
def
test_fix_calls_noops
(
src
):
...
@@ -50,6 +46,22 @@ def test_fix_calls_noops(src):
...
@@ -50,6 +46,22 @@ def test_fix_calls_noops(src):
assert
ret
==
src
assert
ret
==
src
def
_has_16806_bug
():
# See https://bugs.python.org/issue16806
return
ast
.
parse
(
'"""
\n
"""'
)
.
body
[
0
]
.
value
.
col_offset
==
-
1
@pytest.mark.xfail
(
not
_has_16806_bug
(),
reason
=
'multiline string parse bug'
)
def
test_ignores_invalid_ast_node
():
src
=
(
'x(
\n
'
' """
\n
'
' """
\n
'
')'
)
assert
_fix_calls
(
src
,
py35_plus
=
False
)
==
src
def
test_py35_plus_rewrite
():
def
test_py35_plus_rewrite
():
src
=
(
src
=
(
'x(
\n
'
'x(
\n
'
...
...
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