[TIP] running away from RSpec

Phlip phlip2005 at gmail.com
Sat Feb 12 15:05:32 PST 2011


>>        def test_that_it_has_4_feet(self):
>>            assert len(self.dog.feet) == 4

Notice that's similar to self.assertEqual(4, len(self.dog.feet)). And...

>> [1] https://github.com/garybernhardt/expecter

that provides

     expect(4) == len(self.dog.feet)

but the problem here is reflection. If a test fails, I want this diagnostic:

   4 should equal len(self.dog.feet) < 4 >

    self.dog == < repr of the dog >
    self == < repr of the self >

I want that diagnostic to be as useful as the "Automatic Watch
Variables" feature in a corporate IDE's debugger.

I don't know how much of that expecter provides. I currently use the
assert handler from pytest; it does a lot of that reflection.

And, of course, the language should support that reflection
out-of-the-box. Give the industry another 10 years...

-- 
  Phlip
  http://c2.com/cgi/wiki?ZeekLand



More information about the testing-in-python mailing list