Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3692453

Browse files
committed
Merge: Give better failure messages in test_strptime (cf. issue #14113).
2 parents 0109e3c + aba2b06 commit 3692453

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

Lib/test/test_strptime.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ def compare_against_time(self, testing, directive, tuple_position,
3838
comparison = testing[self.time_tuple[tuple_position]]
3939
self.assertIn(strftime_output, testing,
4040
"%s: not found in tuple" % error_msg)
41-
self.assertTrue(comparison == strftime_output,
42-
"%s: position within tuple incorrect; %s != %s" %
43-
(error_msg, comparison, strftime_output))
41+
self.assertEqual(comparison, strftime_output,
42+
"%s: position within tuple incorrect; %s != %s" %
43+
(error_msg, comparison, strftime_output))
4444

4545
def test_weekday(self):
4646
# Make sure that full and abbreviated weekday names are correct in
@@ -65,8 +65,8 @@ def test_am_pm(self):
6565
"AM/PM representation not in tuple")
6666
if self.time_tuple[3] < 12: position = 0
6767
else: position = 1
68-
self.assertTrue(strftime_output == self.LT_ins.am_pm[position],
69-
"AM/PM representation in the wrong position within the tuple")
68+
self.assertEqual(self.LT_ins.am_pm[position], strftime_output,
69+
"AM/PM representation in the wrong position within the tuple")
7070

7171
def test_timezone(self):
7272
# Make sure timezone is correct
@@ -165,8 +165,8 @@ def test_blankpattern(self):
165165
# Fixes bug #661354
166166
test_locale = _strptime.LocaleTime()
167167
test_locale.timezone = (frozenset(), frozenset())
168-
self.assertTrue(_strptime.TimeRE(test_locale).pattern("%Z") == '',
169-
"with timezone == ('',''), TimeRE().pattern('%Z') != ''")
168+
self.assertEqual(_strptime.TimeRE(test_locale).pattern("%Z"), '',
169+
"with timezone == ('',''), TimeRE().pattern('%Z') != ''")
170170

171171
def test_matching_with_escapes(self):
172172
# Make sure a format that requires escaping of characters works
@@ -192,7 +192,7 @@ def test_whitespace_substitution(self):
192192
# so as to not allow to subpatterns to end up next to each other and
193193
# "steal" characters from each other.
194194
pattern = self.time_re.pattern('%j %H')
195-
self.assertTrue(not re.match(pattern, "180"))
195+
self.assertFalse(re.match(pattern, "180"))
196196
self.assertTrue(re.match(pattern, "18 0"))
197197

198198

0 commit comments

Comments
 (0)