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
5e307de6
Kaydet (Commit)
5e307de6
authored
Haz 23, 2010
tarafından
Alexander Belopolsky
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added more test cases
üst
33b94c9f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
test_datetime.py
Lib/test/test_datetime.py
+13
-1
No files found.
Lib/test/test_datetime.py
Dosyayı görüntüle @
5e307de6
...
...
@@ -172,6 +172,7 @@ class TestTimeZone(unittest.TestCase):
with
self
.
assertRaises
(
TypeError
):
timezone
(
42
)
with
self
.
assertRaises
(
TypeError
):
timezone
(
ZERO
,
None
)
with
self
.
assertRaises
(
TypeError
):
timezone
(
ZERO
,
42
)
with
self
.
assertRaises
(
TypeError
):
timezone
(
ZERO
,
'ABC'
,
'extra'
)
def
test_inheritance
(
self
):
self
.
assertIsInstance
(
timezone
.
utc
,
tzinfo
)
...
...
@@ -207,6 +208,8 @@ class TestTimeZone(unittest.TestCase):
def
test_fromutc
(
self
):
with
self
.
assertRaises
(
ValueError
):
timezone
.
utc
.
fromutc
(
self
.
DT
)
with
self
.
assertRaises
(
TypeError
):
timezone
.
utc
.
fromutc
(
'not datetime'
)
for
tz
in
[
self
.
EST
,
self
.
ACDT
,
Eastern
]:
utctime
=
self
.
DT
.
replace
(
tzinfo
=
tz
)
local
=
tz
.
fromutc
(
utctime
)
...
...
@@ -1845,6 +1848,8 @@ class TestDateTime(TestDate):
self
.
assertRaises
(
TypeError
,
combine
,
t
,
d
)
# args reversed
self
.
assertRaises
(
TypeError
,
combine
,
d
,
t
,
1
)
# too many args
self
.
assertRaises
(
TypeError
,
combine
,
"date"
,
"time"
)
# wrong types
self
.
assertRaises
(
TypeError
,
combine
,
d
,
"time"
)
# wrong type
self
.
assertRaises
(
TypeError
,
combine
,
"date"
,
t
)
# wrong type
def
test_replace
(
self
):
cls
=
self
.
theclass
...
...
@@ -1887,6 +1892,8 @@ class TestDateTime(TestDate):
def
dst
(
self
,
dt
):
return
timedelta
(
0
)
bog
=
Bogus
()
self
.
assertRaises
(
ValueError
,
dt
.
astimezone
,
bog
)
# naive
self
.
assertRaises
(
ValueError
,
dt
.
replace
(
tzinfo
=
bog
)
.
astimezone
,
f
)
class
AlsoBogus
(
tzinfo
):
def
utcoffset
(
self
,
dt
):
return
timedelta
(
0
)
...
...
@@ -2863,6 +2870,11 @@ class TestDateTimeTZ(TestDateTime, TZInfoBase, unittest.TestCase):
maxdiff
=
max
-
min
self
.
assertEqual
(
maxdiff
,
self
.
theclass
.
max
-
self
.
theclass
.
min
+
timedelta
(
minutes
=
2
*
1439
))
# Different tzinfo, but the same offset
tza
=
timezone
(
HOUR
,
'A'
)
tzb
=
timezone
(
HOUR
,
'B'
)
delta
=
min
.
replace
(
tzinfo
=
tza
)
-
max
.
replace
(
tzinfo
=
tzb
)
self
.
assertEqual
(
delta
,
self
.
theclass
.
min
-
self
.
theclass
.
max
)
def
test_tzinfo_now
(
self
):
meth
=
self
.
theclass
.
now
...
...
@@ -3499,7 +3511,7 @@ class TestTimezoneConversions(unittest.TestCase):
self
.
assertRaises
(
ValueError
,
now
.
astimezone
,
notok
())
# Sometimes blow up. In the following, tzinfo.dst()
# implementation may return None or not Nonedepending on
# implementation may return None or not None
depending on
# whether DST is assumed to be in effect. In this situation,
# a ValueError should be raised by astimezone().
class
tricky_notok
(
ok
):
...
...
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