[TIP] Sclara is a Python testing DSL

Andrea Crotti andrea.crotti.0 at gmail.com
Mon Mar 26 06:10:51 PDT 2012


On 03/26/2012 01:48 PM, Ned Batchelder wrote:
> On 3/26/2012 8:28 AM, Staple, Danny (BSKYB) wrote:
>>
>> Hmm -- I am thinking that a python dsl similar to JS's Jasmine with 
>> matchers would be doable.
>>
>> with describe("foo"):
>>
>>   It("should throw bar"):
>>
>>     expect( lambda : foo.doStuff()).toRaise(BarException);
>>
> I've never seen the value in ladling English all over my test cases.  
> How is your code better than what you can currently do with unittest?:
>
>     def test_should_throw_bar(self):
>         """foo should throw bar"""
>         with self.assertRaises(BarException):
>             foo.doStuff()
>
> Not to mention, the snippet you presented isn't valid Python, yet 
> involves a lambda...
>
> --Ned.

Agreed, in this way you throw away the help given from your editor to 
check your syntax validity,
writing the same code (if not harder).

I like the idea of hierarchical context, but it also looks like that 
every time you have to do that probably
the code smells bad already..
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20120326/ceac55cf/attachment-0001.htm>


More information about the testing-in-python mailing list