Commit 3692453a authored by Nadeem Vawda's avatar Nadeem Vawda

Merge: Give better failure messages in test_strptime (cf. issue #14113).

parents 0109e3cd aba2b060
...@@ -38,7 +38,7 @@ class LocaleTime_Tests(unittest.TestCase): ...@@ -38,7 +38,7 @@ class LocaleTime_Tests(unittest.TestCase):
comparison = testing[self.time_tuple[tuple_position]] comparison = testing[self.time_tuple[tuple_position]]
self.assertIn(strftime_output, testing, self.assertIn(strftime_output, testing,
"%s: not found in tuple" % error_msg) "%s: not found in tuple" % error_msg)
self.assertTrue(comparison == strftime_output, self.assertEqual(comparison, strftime_output,
"%s: position within tuple incorrect; %s != %s" % "%s: position within tuple incorrect; %s != %s" %
(error_msg, comparison, strftime_output)) (error_msg, comparison, strftime_output))
...@@ -65,7 +65,7 @@ class LocaleTime_Tests(unittest.TestCase): ...@@ -65,7 +65,7 @@ class LocaleTime_Tests(unittest.TestCase):
"AM/PM representation not in tuple") "AM/PM representation not in tuple")
if self.time_tuple[3] < 12: position = 0 if self.time_tuple[3] < 12: position = 0
else: position = 1 else: position = 1
self.assertTrue(strftime_output == self.LT_ins.am_pm[position], self.assertEqual(self.LT_ins.am_pm[position], strftime_output,
"AM/PM representation in the wrong position within the tuple") "AM/PM representation in the wrong position within the tuple")
def test_timezone(self): def test_timezone(self):
...@@ -165,7 +165,7 @@ class TimeRETests(unittest.TestCase): ...@@ -165,7 +165,7 @@ class TimeRETests(unittest.TestCase):
# Fixes bug #661354 # Fixes bug #661354
test_locale = _strptime.LocaleTime() test_locale = _strptime.LocaleTime()
test_locale.timezone = (frozenset(), frozenset()) test_locale.timezone = (frozenset(), frozenset())
self.assertTrue(_strptime.TimeRE(test_locale).pattern("%Z") == '', self.assertEqual(_strptime.TimeRE(test_locale).pattern("%Z"), '',
"with timezone == ('',''), TimeRE().pattern('%Z') != ''") "with timezone == ('',''), TimeRE().pattern('%Z') != ''")
def test_matching_with_escapes(self): def test_matching_with_escapes(self):
...@@ -192,7 +192,7 @@ class TimeRETests(unittest.TestCase): ...@@ -192,7 +192,7 @@ class TimeRETests(unittest.TestCase):
# so as to not allow to subpatterns to end up next to each other and # so as to not allow to subpatterns to end up next to each other and
# "steal" characters from each other. # "steal" characters from each other.
pattern = self.time_re.pattern('%j %H') pattern = self.time_re.pattern('%j %H')
self.assertTrue(not re.match(pattern, "180")) self.assertFalse(re.match(pattern, "180"))
self.assertTrue(re.match(pattern, "18 0")) self.assertTrue(re.match(pattern, "18 0"))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment