Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
a6bdfd1f
Commit
a6bdfd1f
authored
Feb 29, 2012
by
Nadeem Vawda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Give better failure messages in test_strptime (cf. issue #14113).
parent
58e5257e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
17 deletions
+14
-17
Lib/test/test_strptime.py
Lib/test/test_strptime.py
+14
-17
No files found.
Lib/test/test_strptime.py
View file @
a6bdfd1f
...
...
@@ -38,7 +38,7 @@ 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
,
self
.
assert
Equal
(
comparison
,
strftime_output
,
"%s: position within tuple incorrect; %s != %s"
%
(
error_msg
,
comparison
,
strftime_output
))
...
...
@@ -65,7 +65,7 @@ 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
]
,
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
):
...
...
@@ -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,7 +165,7 @@ 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
") ==
'',
self.assert
Equal(_strptime.TimeRE(test_locale).pattern("
%
Z
"),
'',
"
with
timezone
==
(
''
,
''
),
TimeRE
().
pattern
(
'%Z'
)
!=
''")
def test_matching_with_escapes(self):
...
...
@@ -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