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
9958c56e
Kaydet (Commit)
9958c56e
authored
Nis 18, 2010
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix catastrophic file opening and closing logic in test_linecache
üst
814b6c22
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
16 deletions
+13
-16
test_linecache.py
Lib/test/test_linecache.py
+13
-16
No files found.
Lib/test/test_linecache.py
Dosyayı görüntüle @
9958c56e
...
@@ -86,31 +86,28 @@ class LineCacheTests(unittest.TestCase):
...
@@ -86,31 +86,28 @@ class LineCacheTests(unittest.TestCase):
source_name
=
support
.
TESTFN
+
'.py'
source_name
=
support
.
TESTFN
+
'.py'
with
open
(
source_name
,
'w'
)
as
source
:
with
open
(
source_name
,
'w'
)
as
source
:
source
.
write
(
SOURCE_1
)
source
.
write
(
SOURCE_1
)
source
.
close
()
getline
(
source_name
,
1
)
getline
(
source_name
,
1
)
# Keep a copy of the old contents
# Keep a copy of the old contents
source_list
=
[]
source_list
=
[]
source
=
open
(
source_name
)
with
open
(
source_name
)
as
source
:
for
index
,
line
in
enumerate
(
source
):
for
index
,
line
in
enumerate
(
source
):
self
.
assertEquals
(
line
,
getline
(
source_name
,
index
+
1
))
self
.
assertEquals
(
line
,
getline
(
source_name
,
index
+
1
))
source_list
.
append
(
line
)
source_list
.
append
(
line
)
source
.
close
()
source
=
open
(
source_name
,
'w'
)
with
open
(
source_name
,
'w'
)
as
source
:
source
.
write
(
SOURCE_2
)
source
.
write
(
SOURCE_2
)
source
.
close
()
# Try to update a bogus cache entry
# Try to update a bogus cache entry
linecache
.
checkcache
(
'dummy'
)
linecache
.
checkcache
(
'dummy'
)
# Check that the cache matches the old contents
# Check that the cache matches the old contents
for
index
,
line
in
enumerate
(
source_list
):
for
index
,
line
in
enumerate
(
source_list
):
self
.
assertEquals
(
line
,
getline
(
source_name
,
index
+
1
))
self
.
assertEquals
(
line
,
getline
(
source_name
,
index
+
1
))
# Update the cache and check whether it matches the new source file
# Update the cache and check whether it matches the new source file
linecache
.
checkcache
(
source_name
)
linecache
.
checkcache
(
source_name
)
source
=
open
(
source_name
)
with
open
(
source_name
)
as
source
:
for
index
,
line
in
enumerate
(
source
):
for
index
,
line
in
enumerate
(
source
):
self
.
assertEquals
(
line
,
getline
(
source_name
,
index
+
1
))
self
.
assertEquals
(
line
,
getline
(
source_name
,
index
+
1
))
source_list
.
append
(
line
)
source_list
.
append
(
line
)
...
...
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