Skip to content

Commit a24348c

Browse files
committed
Make some tests more verbose in the face of failure
1 parent baacf4d commit a24348c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Lib/test/test_module.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,12 @@ def test_module_repr_builtin(self):
191191

192192
def test_module_repr_source(self):
193193
r = repr(unittest)
194-
self.assertEqual(r[:25], "<module 'unittest' from '")
195-
self.assertEqual(r[-13:], "__init__.py'>")
194+
starts_with = "<module 'unittest' from '"
195+
ends_with = "__init__.py'>"
196+
self.assertEqual(r[:len(starts_with)], starts_with,
197+
'{!r} does not start with {!r}'.format(r, starts_with))
198+
self.assertEqual(r[-len(ends_with):], ends_with,
199+
'{!r} does not end with {!r}'.format(r, ends_with))
196200

197201
def test_module_finalization_at_shutdown(self):
198202
# Module globals and builtins should still be available during shutdown

0 commit comments

Comments
 (0)