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
a6bdfd1f
Kaydet (Commit)
a6bdfd1f
authored
Şub 28, 2012
tarafından
Nadeem Vawda
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Give better failure messages in test_strptime (cf. issue #14113).
üst
58e5257e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
17 deletions
+14
-17
test_strptime.py
Lib/test/test_strptime.py
+14
-17
No files found.
Lib/test/test_strptime.py
Dosyayı görüntüle @
a6bdfd1f
...
...
@@ -38,9 +38,9 @@ class LocaleTime_Tests(unittest.TestCase):
comparison
=
testing
[
self
.
time_tuple
[
tuple_position
]]
self
.
assertIn
(
strftime_output
,
testing
,
"
%
s: not found in tuple"
%
error_msg
)
self
.
assert
True
(
comparison
==
strftime_output
,
"
%
s: position within tuple incorrect;
%
s !=
%
s"
%
(
error_msg
,
comparison
,
strftime_output
))
self
.
assert
Equal
(
comparison
,
strftime_output
,
"
%
s: position within tuple incorrect;
%
s !=
%
s"
%
(
error_msg
,
comparison
,
strftime_output
))
def
test_weekday
(
self
):
# Make sure that full and abbreviated weekday names are correct in
...
...
@@ -65,8 +65,8 @@ class LocaleTime_Tests(unittest.TestCase):
"AM/PM representation not in tuple"
)
if
self
.
time_tuple
[
3
]
<
12
:
position
=
0
else
:
position
=
1
self
.
assert
True
(
strftime_output
==
self
.
LT_ins
.
am_pm
[
position
]
,
"AM/PM representation in the wrong position within the tuple"
)
self
.
assert
Equal
(
self
.
LT_ins
.
am_pm
[
position
],
strftime_output
,
"AM/PM representation in the wrong position within the tuple"
)
def
test_timezone
(
self
):
# Make sure timezone is correct
...
...
@@ -86,17 +86,14 @@ class LocaleTime_Tests(unittest.TestCase):
# output.
magic_date
=
(
1999
,
3
,
17
,
22
,
44
,
55
,
2
,
76
,
0
)
strftime_output
=
time
.
strftime
(
"
%
c"
,
magic_date
)
self
.
assertTrue
(
strftime_output
==
time
.
strftime
(
self
.
LT_ins
.
LC_date_time
,
magic_date
),
"LC_date_time incorrect"
)
self
.
assertEqual
(
time
.
strftime
(
self
.
LT_ins
.
LC_date_time
,
magic_date
),
strftime_output
,
"LC_date_time incorrect"
)
strftime_output
=
time
.
strftime
(
"
%
x"
,
magic_date
)
self
.
assertTrue
(
strftime_output
==
time
.
strftime
(
self
.
LT_ins
.
LC_date
,
magic_date
),
"LC_date incorrect"
)
self
.
assertEqual
(
time
.
strftime
(
self
.
LT_ins
.
LC_date
,
magic_date
),
strftime_output
,
"LC_date incorrect"
)
strftime_output
=
time
.
strftime
(
"
%
X"
,
magic_date
)
self
.
assertTrue
(
strftime_output
==
time
.
strftime
(
self
.
LT_ins
.
LC_time
,
magic_date
),
"LC_time incorrect"
)
self
.
assertEqual
(
time
.
strftime
(
self
.
LT_ins
.
LC_time
,
magic_date
),
strftime_output
,
"LC_time incorrect"
)
LT
=
_strptime
.
LocaleTime
()
LT
.
am_pm
=
(
''
,
''
)
self
.
assertTrue
(
LT
.
LC_time
,
"LocaleTime's LC directives cannot handle "
...
...
@@ -168,8 +165,8 @@ class TimeRETests(unittest.TestCase):
# Fixes bug #661354
test_locale
=
_strptime
.
LocaleTime
()
test_locale
.
timezone
=
(
frozenset
(),
frozenset
())
self
.
assert
True
(
_strptime
.
TimeRE
(
test_locale
)
.
pattern
(
"
%
Z"
)
==
''
,
"with timezone == ('',''), TimeRE().pattern('
%
Z') != ''"
)
self
.
assert
Equal
(
_strptime
.
TimeRE
(
test_locale
)
.
pattern
(
"
%
Z"
),
''
,
"with timezone == ('',''), TimeRE().pattern('
%
Z') != ''"
)
def
test_matching_with_escapes
(
self
):
# Make sure a format that requires escaping of characters works
...
...
@@ -195,7 +192,7 @@ class TimeRETests(unittest.TestCase):
# so as to not allow to subpatterns to end up next to each other and
# "steal" characters from each other.
pattern
=
self
.
time_re
.
pattern
(
'
%
j
%
H'
)
self
.
assert
True
(
not
re
.
match
(
pattern
,
"180"
))
self
.
assert
False
(
re
.
match
(
pattern
,
"180"
))
self
.
assertTrue
(
re
.
match
(
pattern
,
"18 0"
))
...
...
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