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
4719ae75
Kaydet (Commit)
4719ae75
authored
Tem 24, 2016
tarafından
Alexander Belopolsky
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #24773: Made ZoneInfoCompleteTest a TestSuit.
This should improve the diagnostic and progress reports.
üst
8dadb215
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
20 deletions
+29
-20
datetimetester.py
Lib/test/datetimetester.py
+21
-18
test_datetime.py
Lib/test/test_datetime.py
+8
-2
No files found.
Lib/test/datetimetester.py
Dosyayı görüntüle @
4719ae75
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
See http://www.zope.org/Members/fdrake/DateTimeWiki/TestCases
See http://www.zope.org/Members/fdrake/DateTimeWiki/TestCases
"""
"""
from
test.support
import
requires
from
test.support
import
is_resource_enabled
import
itertools
import
itertools
import
bisect
import
bisect
...
@@ -1726,7 +1726,7 @@ class TestDateTime(TestDate):
...
@@ -1726,7 +1726,7 @@ class TestDateTime(TestDate):
# Positional fold:
# Positional fold:
self
.
assertRaises
(
TypeError
,
self
.
theclass
,
self
.
assertRaises
(
TypeError
,
self
.
theclass
,
2000
,
1
,
31
,
23
,
59
,
59
,
0
,
None
,
1
)
2000
,
1
,
31
,
23
,
59
,
59
,
0
,
None
,
1
)
def
test_hash_equality
(
self
):
def
test_hash_equality
(
self
):
d
=
self
.
theclass
(
2000
,
12
,
31
,
23
,
30
,
17
)
d
=
self
.
theclass
(
2000
,
12
,
31
,
23
,
30
,
17
)
e
=
self
.
theclass
(
2000
,
12
,
31
,
23
,
30
,
17
)
e
=
self
.
theclass
(
2000
,
12
,
31
,
23
,
30
,
17
)
...
@@ -4254,7 +4254,7 @@ class TestLocalTimeDisambiguation(unittest.TestCase):
...
@@ -4254,7 +4254,7 @@ class TestLocalTimeDisambiguation(unittest.TestCase):
t
.
replace
(
1
,
1
,
1
,
None
,
1
)
t
.
replace
(
1
,
1
,
1
,
None
,
1
)
with
self
.
assertRaises
(
TypeError
):
with
self
.
assertRaises
(
TypeError
):
dt
.
replace
(
1
,
1
,
1
,
1
,
1
,
1
,
1
,
None
,
1
)
dt
.
replace
(
1
,
1
,
1
,
1
,
1
,
1
,
1
,
None
,
1
)
def
test_comparison
(
self
):
def
test_comparison
(
self
):
t
=
time
(
0
)
t
=
time
(
0
)
dt
=
datetime
(
1
,
1
,
1
)
dt
=
datetime
(
1
,
1
,
1
)
...
@@ -4677,10 +4677,7 @@ class ZoneInfoTest(unittest.TestCase):
...
@@ -4677,10 +4677,7 @@ class ZoneInfoTest(unittest.TestCase):
def
setUp
(
self
):
def
setUp
(
self
):
if
sys
.
platform
==
"win32"
:
if
sys
.
platform
==
"win32"
:
self
.
skipTest
(
"Skipping zoneinfo tests on Windows"
)
self
.
skipTest
(
"Skipping zoneinfo tests on Windows"
)
try
:
self
.
tz
=
ZoneInfo
.
fromname
(
self
.
zonename
)
self
.
tz
=
ZoneInfo
.
fromname
(
self
.
zonename
)
except
FileNotFoundError
as
err
:
self
.
skipTest
(
"Skipping
%
s:
%
s"
%
(
self
.
zonename
,
err
))
def
assertEquivDatetimes
(
self
,
a
,
b
):
def
assertEquivDatetimes
(
self
,
a
,
b
):
self
.
assertEqual
((
a
.
replace
(
tzinfo
=
None
),
a
.
fold
,
id
(
a
.
tzinfo
)),
self
.
assertEqual
((
a
.
replace
(
tzinfo
=
None
),
a
.
fold
,
id
(
a
.
tzinfo
)),
...
@@ -4741,7 +4738,7 @@ class ZoneInfoTest(unittest.TestCase):
...
@@ -4741,7 +4738,7 @@ class ZoneInfoTest(unittest.TestCase):
# civil time was generally not solar time in those years.
# civil time was generally not solar time in those years.
self
.
zonename
.
startswith
(
'right/'
)):
self
.
zonename
.
startswith
(
'right/'
)):
self
.
skipTest
(
"Skipping
%
s"
%
self
.
zonename
)
self
.
skipTest
(
"Skipping
%
s"
%
self
.
zonename
)
tz
=
self
.
tz
tz
=
ZoneInfo
.
fromname
(
self
.
zonename
)
TZ
=
os
.
environ
.
get
(
'TZ'
)
TZ
=
os
.
environ
.
get
(
'TZ'
)
os
.
environ
[
'TZ'
]
=
self
.
zonename
os
.
environ
[
'TZ'
]
=
self
.
zonename
try
:
try
:
...
@@ -4775,20 +4772,26 @@ class ZoneInfoTest(unittest.TestCase):
...
@@ -4775,20 +4772,26 @@ class ZoneInfoTest(unittest.TestCase):
_time
.
tzset
()
_time
.
tzset
()
class
ZoneInfoCompleteTest
(
unittest
.
TestCase
):
class
ZoneInfoCompleteTest
(
unittest
.
TestSuite
):
def
test_all
(
self
):
def
__init__
(
self
):
requires
(
'tzdata'
,
'test requires tzdata and a long time to run'
)
tests
=
[]
for
name
in
ZoneInfo
.
zonenames
():
if
is_resource_enabled
(
'tzdata'
):
class
Test
(
ZoneInfoTest
):
for
name
in
ZoneInfo
.
zonenames
():
zonename
=
name
Test
=
type
(
'ZoneInfoTest[
%
s]'
%
name
,
(
ZoneInfoTest
,),
{})
for
suffix
in
[
'folds'
,
'gaps'
,
'system_transitions'
]:
Test
.
zonename
=
name
test
=
Test
(
'test_'
+
suffix
)
for
method
in
dir
(
Test
):
result
=
test
.
run
()
if
method
.
startswith
(
'test_'
):
self
.
assertTrue
(
result
.
wasSuccessful
(),
name
+
' '
+
suffix
)
tests
.
append
(
Test
(
method
))
super
()
.
__init__
(
tests
)
# Iran had a sub-minute UTC offset before 1946.
# Iran had a sub-minute UTC offset before 1946.
class
IranTest
(
ZoneInfoTest
):
class
IranTest
(
ZoneInfoTest
):
zonename
=
'Iran'
zonename
=
'Iran'
def
load_tests
(
loader
,
standard_tests
,
pattern
):
standard_tests
.
addTest
(
ZoneInfoCompleteTest
())
return
standard_tests
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
unittest
.
main
()
unittest
.
main
()
Lib/test/test_datetime.py
Dosyayı görüntüle @
4719ae75
...
@@ -23,9 +23,16 @@ test_suffixes = ["_Pure", "_Fast"]
...
@@ -23,9 +23,16 @@ test_suffixes = ["_Pure", "_Fast"]
test_classes
=
[]
test_classes
=
[]
for
module
,
suffix
in
zip
(
test_modules
,
test_suffixes
):
for
module
,
suffix
in
zip
(
test_modules
,
test_suffixes
):
test_classes
=
[]
for
name
,
cls
in
module
.
__dict__
.
items
():
for
name
,
cls
in
module
.
__dict__
.
items
():
if
not
(
isinstance
(
cls
,
type
)
and
issubclass
(
cls
,
unittest
.
TestCase
)
):
if
not
isinstance
(
cls
,
type
):
continue
continue
if
issubclass
(
cls
,
unittest
.
TestCase
):
test_classes
.
append
(
cls
)
elif
issubclass
(
cls
,
unittest
.
TestSuite
):
suit
=
cls
()
test_classes
.
extend
(
type
(
test
)
for
test
in
suit
)
for
cls
in
test_classes
:
cls
.
__name__
=
name
+
suffix
cls
.
__name__
=
name
+
suffix
@classmethod
@classmethod
def
setUpClass
(
cls_
,
module
=
module
):
def
setUpClass
(
cls_
,
module
=
module
):
...
@@ -39,7 +46,6 @@ for module, suffix in zip(test_modules, test_suffixes):
...
@@ -39,7 +46,6 @@ for module, suffix in zip(test_modules, test_suffixes):
sys
.
modules
.
update
(
cls_
.
_save_sys_modules
)
sys
.
modules
.
update
(
cls_
.
_save_sys_modules
)
cls
.
setUpClass
=
setUpClass
cls
.
setUpClass
=
setUpClass
cls
.
tearDownClass
=
tearDownClass
cls
.
tearDownClass
=
tearDownClass
test_classes
.
append
(
cls
)
def
test_main
():
def
test_main
():
run_unittest
(
*
test_classes
)
run_unittest
(
*
test_classes
)
...
...
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