Hi Giampaolo,

changeset:   53a5a5b8859d
user:        Giampaolo Rodola' <g.rod...@gmail.com>
date:        Mon Jan 09 17:10:10 2012 +0100
summary:
  provide a common method to check for RETR_DATA validity, first
checking the expected len and then the actual data content; this
way we get a failure on len mismatch rather than content mismatch
(which is very long and unreadable)

My trick is to convert long strings to lists (with
data.split(appropriate line ending)) and pass them to assertEqual.
Then I get more readable element-based diffs when there is a test
failure.

Another trick I use is this (for example when I don’t want to make
too much diff noise, or when I don’t want to build the list of
expected results):

  self.assertEqual(len(got), 3, got)

unittest will print the third argument on failure.

Regards
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to