Yelp/Testify — pull request #61 by dnephin (2012-04-02 23:37:23+00:00)
Title: Some additions for Turtle

These are a few additions I needed while working on Tron. I thought they might be useful more generally as well. I'm open to removing any of them if you feel they don't belong in Testify.

* `assert_raises` returns the exception instead of True. I've found this useful when an exception can be thrown for more then one reason. This allows you to make assertions about the message or any other fields on the exception. This should still be backwards compatible since exceptions should be truthy. It does seem kind of weird that an assert returns a non-boolean.

* added `assert_length`. asserts the length of a sequence (which is done quite often when using Turtles)

* added `assert_call`. asserts that a Turtle was called with the argument spec. This makes assertions on turtle calls much cleaner (see example in `test_turtle.py`)

* `Turtle` returns an object created using type(self) instead of Turtle so that subclasses of Turtle return objects of their type. Returned turtles are also stored in self.returns. I've found this necessary in some cases.