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
327af775
Kaydet (Commit)
327af775
authored
Agu 22, 2002
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Standardize behavior: no docstrings in test functions. Also strip
trailing whitespace.
üst
1c48654e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
16 deletions
+16
-16
test_textwrap.py
Lib/test/test_textwrap.py
+16
-16
No files found.
Lib/test/test_textwrap.py
Dosyayı görüntüle @
327af775
...
...
@@ -29,7 +29,7 @@ class BaseTestCase(unittest.TestCase):
def
check
(
self
,
result
,
expect
):
self
.
assertEquals
(
result
,
expect
,
self
.
assertEquals
(
result
,
expect
,
'expected:
\n
%
s
\n
but got:
\n
%
s'
%
(
self
.
show
(
expect
),
self
.
show
(
result
)))
...
...
@@ -44,7 +44,7 @@ class WrapTestCase(BaseTestCase):
self
.
wrapper
=
TextWrapper
(
width
=
45
,
fix_sentence_endings
=
True
)
def
test_simple
(
self
):
'''Simple case: just words, spaces, and a bit of punctuation.'''
# Simple case: just words, spaces, and a bit of punctuation
text
=
"Hello there, how are you this fine day? I'm glad to hear it!"
...
...
@@ -62,7 +62,7 @@ class WrapTestCase(BaseTestCase):
def
test_whitespace
(
self
):
'''Whitespace munging and end-of-sentence detection.'''
# Whitespace munging and end-of-sentence detection
text
=
"""
\
This is a paragraph that already has
...
...
@@ -86,7 +86,7 @@ What a mess!
def
test_wrap_short
(
self
):
'''Wrapping to make short lines longer.'''
# Wrapping to make short lines longer
text
=
"This is a
\n
short paragraph."
...
...
@@ -96,7 +96,7 @@ What a mess!
def
test_hyphenated
(
self
):
'''Test breaking hyphenated words.'''
# Test breaking hyphenated words
text
=
(
"this-is-a-useful-feature-for-"
"reformatting-posts-from-tim-peters'ly"
)
...
...
@@ -112,7 +112,7 @@ What a mess!
"posts-from-tim-peters'ly"
])
def
test_em_dash
(
self
):
'''Test text with em-dashes.'''
# Test text with em-dashes
text
=
"Em-dashes should be written -- thus."
self
.
check_wrap
(
text
,
25
,
[
"Em-dashes should be"
,
...
...
@@ -129,7 +129,7 @@ What a mess!
self
.
check_wrap
(
text
,
35
,
expect
)
self
.
check_wrap
(
text
,
36
,
[
"Em-dashes should be written -- thus."
])
# The improperly written em-dash is handled too, because
# it's adjacent to non-whitespace on both sides.
text
=
"You can also do--this or even---this."
...
...
@@ -164,8 +164,8 @@ What a mess!
"but got
%
r"
%
(
expect
,
result
))
def
test_split
(
self
):
'''Ensure that the standard _split() method works as advertised
in the comments.'''
# Ensure that the standard _split() method works as advertised
# in the comments
text
=
"Hello there -- you goof-ball, use the -b option!"
...
...
@@ -184,7 +184,7 @@ How *do* you spell that odd word, anyways?
'''
def
test_break_long
(
self
):
'''Wrap text with long words and lots of punctuation.'''
# Wrap text with long words and lots of punctuation
self
.
check_wrap
(
self
.
text
,
30
,
[
'Did you say "supercalifragilis'
,
...
...
@@ -196,15 +196,15 @@ How *do* you spell that odd word, anyways?
'How *do* you spell that odd word, anyways?'
])
def
test_nobreak_long
(
self
):
'''Test with break_long_words disabled.'''
def
test_nobreak_long
(
self
):
# Test with break_long_words disabled
self
.
wrapper
.
break_long_words
=
0
self
.
wrapper
.
width
=
30
expect
=
[
'Did you say'
,
'"supercalifragilisticexpialidocious?"'
,
'How *do* you spell that odd'
,
'word, anyways?'
]
]
result
=
self
.
wrapper
.
wrap
(
self
.
text
)
self
.
check
(
result
,
expect
)
...
...
@@ -224,7 +224,7 @@ and then with some (including a hanging indent).'''
def
test_fill
(
self
):
'''Test the fill() method.'''
# Test the fill() method
expect
=
'''
\
This paragraph will be filled, first
...
...
@@ -236,7 +236,7 @@ some (including a hanging indent).'''
def
test_initial_indent
(
self
):
'''Test initial_indent parameter.'''
# Test initial_indent parameter
expect
=
[
" This paragraph will be filled,"
,
"first without any indentation, and then"
,
...
...
@@ -250,7 +250,7 @@ some (including a hanging indent).'''
def
test_subsequent_indent
(
self
):
'''Test subsequent_indent parameter.'''
# Test subsequent_indent parameter
expect
=
'''
\
* This paragraph will be filled, first
...
...
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