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
b5c23761
Kaydet (Commit)
b5c23761
authored
Agu 04, 2010
tarafından
Giampaolo Rodolà
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
issue #8687: provides a test suite for sched.py module
üst
934abdda
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
85 additions
and
1 deletion
+85
-1
test_sched.py
Lib/test/test_sched.py
+80
-0
test_sundry.py
Lib/test/test_sundry.py
+0
-1
NEWS
Misc/NEWS
+5
-0
No files found.
Lib/test/test_sched.py
0 → 100644
Dosyayı görüntüle @
b5c23761
#!/usr/bin/env python
import
sched
import
time
import
unittest
from
test
import
support
class
TestCase
(
unittest
.
TestCase
):
def
test_enter
(
self
):
l
=
[]
fun
=
lambda
x
:
l
.
append
(
x
)
scheduler
=
sched
.
scheduler
(
time
.
time
,
time
.
sleep
)
for
x
in
[
0.05
,
0.04
,
0.03
,
0.02
,
0.01
]:
z
=
scheduler
.
enter
(
x
,
1
,
fun
,
(
x
,))
scheduler
.
run
()
self
.
assertEqual
(
l
,
[
0.01
,
0.02
,
0.03
,
0.04
,
0.05
])
def
test_enterabs
(
self
):
l
=
[]
fun
=
lambda
x
:
l
.
append
(
x
)
scheduler
=
sched
.
scheduler
(
time
.
time
,
time
.
sleep
)
for
x
in
[
0.05
,
0.04
,
0.03
,
0.02
,
0.01
]:
z
=
scheduler
.
enterabs
(
x
,
1
,
fun
,
(
x
,))
scheduler
.
run
()
self
.
assertEqual
(
l
,
[
0.01
,
0.02
,
0.03
,
0.04
,
0.05
])
def
test_priority
(
self
):
l
=
[]
fun
=
lambda
x
:
l
.
append
(
x
)
scheduler
=
sched
.
scheduler
(
time
.
time
,
time
.
sleep
)
for
priority
in
[
1
,
2
,
3
,
4
,
5
]:
z
=
scheduler
.
enter
(
0.01
,
priority
,
fun
,
(
priority
,))
scheduler
.
run
()
self
.
assertEqual
(
l
,
[
1
,
2
,
3
,
4
,
5
])
def
test_cancel
(
self
):
l
=
[]
fun
=
lambda
x
:
l
.
append
(
x
)
scheduler
=
sched
.
scheduler
(
time
.
time
,
time
.
sleep
)
event1
=
scheduler
.
enter
(
0.01
,
1
,
fun
,
(
0.01
,))
event2
=
scheduler
.
enter
(
0.02
,
1
,
fun
,
(
0.02
,))
event3
=
scheduler
.
enter
(
0.03
,
1
,
fun
,
(
0.03
,))
event4
=
scheduler
.
enter
(
0.04
,
1
,
fun
,
(
0.04
,))
event5
=
scheduler
.
enter
(
0.05
,
1
,
fun
,
(
0.05
,))
scheduler
.
cancel
(
event1
)
scheduler
.
cancel
(
event5
)
scheduler
.
run
()
self
.
assertEqual
(
l
,
[
0.02
,
0.03
,
0.04
])
def
test_empty
(
self
):
l
=
[]
fun
=
lambda
x
:
l
.
append
(
x
)
scheduler
=
sched
.
scheduler
(
time
.
time
,
time
.
sleep
)
self
.
assertTrue
(
scheduler
.
empty
())
for
x
in
[
0.05
,
0.04
,
0.03
,
0.02
,
0.01
]:
z
=
scheduler
.
enterabs
(
x
,
1
,
fun
,
(
x
,))
self
.
assertFalse
(
scheduler
.
empty
())
scheduler
.
run
()
self
.
assertTrue
(
scheduler
.
empty
())
def
test_queue
(
self
):
l
=
[]
events
=
[]
fun
=
lambda
x
:
l
.
append
(
x
)
scheduler
=
sched
.
scheduler
(
time
.
time
,
time
.
sleep
)
self
.
assertEqual
(
scheduler
.
_queue
,
[])
for
x
in
[
0.05
,
0.04
,
0.03
,
0.02
,
0.01
]:
events
.
append
(
scheduler
.
enterabs
(
x
,
1
,
fun
,
(
x
,)))
self
.
assertEqual
(
scheduler
.
_queue
.
sort
(),
events
.
sort
())
scheduler
.
run
()
self
.
assertEqual
(
scheduler
.
_queue
,
[])
def
test_main
():
support
.
run_unittest
(
TestCase
)
if
__name__
==
"__main__"
:
test_main
()
Lib/test/test_sundry.py
Dosyayı görüntüle @
b5c23761
...
@@ -57,7 +57,6 @@ class TestUntestedModules(unittest.TestCase):
...
@@ -57,7 +57,6 @@ class TestUntestedModules(unittest.TestCase):
import
pstats
import
pstats
import
py_compile
import
py_compile
import
rlcompleter
import
rlcompleter
import
sched
import
sndhdr
import
sndhdr
import
symbol
import
symbol
import
tabnanny
import
tabnanny
...
...
Misc/NEWS
Dosyayı görüntüle @
b5c23761
...
@@ -105,6 +105,11 @@ Tools/Demos
...
@@ -105,6 +105,11 @@ Tools/Demos
- Issue #8867: Fix ``Tools/scripts/serve.py`` to work with files containing
- Issue #8867: Fix ``Tools/scripts/serve.py`` to work with files containing
non-ASCII content.
non-ASCII content.
Tests
-----
- Issue #8687: provide a test suite for sched.py module.
What's New in Python 3.2 Alpha 1?
What's New in Python 3.2 Alpha 1?
=================================
=================================
...
...
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