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
6a111027
Kaydet (Commit)
6a111027
authored
May 28, 2009
tarafından
Philip Jenvey
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
explicitly close files
üst
dd0388a1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
30 deletions
+29
-30
test_difflib.py
Lib/test/test_difflib.py
+5
-6
test_inspect.py
Lib/test/test_inspect.py
+2
-1
test_univnewlines.py
Lib/test/test_univnewlines.py
+22
-23
No files found.
Lib/test/test_difflib.py
Dosyayı görüntüle @
6a111027
...
...
@@ -135,14 +135,13 @@ class TestSFpatches(unittest.TestCase):
k
.
make_table
(
f3
.
splitlines
(
True
),
t3
.
splitlines
(
True
)),
])
actual
=
full
.
replace
(
'</body>'
,
'
\n
%
s
\n
</body>'
%
tables
)
# temporarily uncomment next three lines to baseline this test
#f = open('test_difflib_expect.html','w')
#f.write(actual)
#f.close()
expect
=
open
(
findfile
(
'test_difflib_expect.html'
))
.
read
()
# temporarily uncomment next two lines to baseline this test
#with open('test_difflib_expect.html','w') as fp:
# fp.write(actual)
self
.
assertEqual
(
actual
,
expect
)
with
open
(
findfile
(
'test_difflib_expect.html'
))
as
fp
:
self
.
assertEqual
(
actual
,
fp
.
read
())
def
test_recursion_limit
(
self
):
# Check if the problem described in patch #1413711 exists.
...
...
Lib/test/test_inspect.py
Dosyayı görüntüle @
6a111027
...
...
@@ -170,7 +170,8 @@ class GetSourceBase(unittest.TestCase):
def
__init__
(
self
,
*
args
,
**
kwargs
):
unittest
.
TestCase
.
__init__
(
self
,
*
args
,
**
kwargs
)
self
.
source
=
file
(
inspect
.
getsourcefile
(
self
.
fodderFile
))
.
read
()
with
open
(
inspect
.
getsourcefile
(
self
.
fodderFile
))
as
fp
:
self
.
source
=
fp
.
read
()
def
sourcerange
(
self
,
top
,
bottom
):
lines
=
self
.
source
.
split
(
"
\n
"
)
...
...
Lib/test/test_univnewlines.py
Dosyayı görüntüle @
6a111027
...
...
@@ -37,9 +37,8 @@ class TestGenericUnivNewlines(unittest.TestCase):
WRITEMODE
=
'wb'
def
setUp
(
self
):
fp
=
open
(
test_support
.
TESTFN
,
self
.
WRITEMODE
)
fp
.
write
(
self
.
DATA
)
fp
.
close
()
with
open
(
test_support
.
TESTFN
,
self
.
WRITEMODE
)
as
fp
:
fp
.
write
(
self
.
DATA
)
def
tearDown
(
self
):
try
:
...
...
@@ -48,35 +47,35 @@ class TestGenericUnivNewlines(unittest.TestCase):
pass
def
test_read
(
self
):
fp
=
open
(
test_support
.
TESTFN
,
self
.
READMODE
)
data
=
fp
.
read
()
with
open
(
test_support
.
TESTFN
,
self
.
READMODE
)
as
fp
:
data
=
fp
.
read
()
self
.
assertEqual
(
data
,
DATA_LF
)
self
.
assertEqual
(
repr
(
fp
.
newlines
),
repr
(
self
.
NEWLINE
))
def
test_readlines
(
self
):
fp
=
open
(
test_support
.
TESTFN
,
self
.
READMODE
)
data
=
fp
.
readlines
()
with
open
(
test_support
.
TESTFN
,
self
.
READMODE
)
as
fp
:
data
=
fp
.
readlines
()
self
.
assertEqual
(
data
,
DATA_SPLIT
)
self
.
assertEqual
(
repr
(
fp
.
newlines
),
repr
(
self
.
NEWLINE
))
def
test_readline
(
self
):
fp
=
open
(
test_support
.
TESTFN
,
self
.
READMODE
)
data
=
[]
d
=
fp
.
readline
()
while
d
:
data
.
append
(
d
)
with
open
(
test_support
.
TESTFN
,
self
.
READMODE
)
as
fp
:
data
=
[]
d
=
fp
.
readline
()
while
d
:
data
.
append
(
d
)
d
=
fp
.
readline
()
self
.
assertEqual
(
data
,
DATA_SPLIT
)
self
.
assertEqual
(
repr
(
fp
.
newlines
),
repr
(
self
.
NEWLINE
))
def
test_seek
(
self
):
fp
=
open
(
test_support
.
TESTFN
,
self
.
READMODE
)
fp
.
readline
()
pos
=
fp
.
tell
()
data
=
fp
.
readlines
()
self
.
assertEqual
(
data
,
DATA_SPLIT
[
1
:])
fp
.
seek
(
pos
)
data
=
fp
.
readlines
()
with
open
(
test_support
.
TESTFN
,
self
.
READMODE
)
as
fp
:
fp
.
readline
()
pos
=
fp
.
tell
()
data
=
fp
.
readlines
()
self
.
assertEqual
(
data
,
DATA_SPLIT
[
1
:])
fp
.
seek
(
pos
)
data
=
fp
.
readlines
()
self
.
assertEqual
(
data
,
DATA_SPLIT
[
1
:])
def
test_execfile
(
self
):
...
...
@@ -106,10 +105,10 @@ class TestCRLFNewlines(TestGenericUnivNewlines):
DATA
=
DATA_CRLF
def
test_tell
(
self
):
fp
=
open
(
test_support
.
TESTFN
,
self
.
READMODE
)
self
.
assertEqual
(
repr
(
fp
.
newlines
),
repr
(
None
))
data
=
fp
.
readline
()
pos
=
fp
.
tell
()
with
open
(
test_support
.
TESTFN
,
self
.
READMODE
)
as
fp
:
self
.
assertEqual
(
repr
(
fp
.
newlines
),
repr
(
None
))
data
=
fp
.
readline
()
pos
=
fp
.
tell
()
self
.
assertEqual
(
repr
(
fp
.
newlines
),
repr
(
self
.
NEWLINE
))
class
TestMixedNewlines
(
TestGenericUnivNewlines
):
...
...
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